Skip to content

Commit 37aa987

Browse files
committed
fixup! Sandbox every test
1 parent b1cff1b commit 37aa987

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

LibGit2Sharp.Tests/RepositoryFixture.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,10 @@ public void CanDiscoverAStandardRepoGivenASubDirectoryOfTheRepoPath()
534534
[Fact]
535535
public void CanDiscoverAStandardRepoGivenTheWorkingDirPath()
536536
{
537-
string path = Repository.Discover(StandardTestRepoWorkingDirPath);
538-
Assert.Equal(Path.GetFullPath(StandardTestRepoPath + Path.DirectorySeparatorChar), path);
537+
string path = Sandbox(StandardTestRepoWorkingDirPath);
538+
539+
string found = Repository.Discover(path);
540+
Assert.Equal(Path.GetFullPath(string.Format("{0}{1}.git{1}", path, Path.DirectorySeparatorChar)), found);
539541
}
540542

541543
[Fact]

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ static BaseFixture()
2727
{
2828
// Do the set up in the static ctor so it only happens once
2929
SetUpTestEnvironment();
30-
31-
DirectoryHelper.DeleteSubdirectories(Constants.TemporaryReposPath);
3230
}
3331

3432
public static string BareTestRepoPath { get; private set; }
@@ -55,34 +53,25 @@ private static void SetUpTestEnvironment()
5553
{
5654
IsFileSystemCaseSensitive = IsFileSystemCaseSensitiveInternal();
5755

58-
var source = new DirectoryInfo(@"../../Resources");
59-
var resourcesRelativePath = string.Format(@"Resources/{0}", Guid.NewGuid());
60-
ResourcesDirectory = new DirectoryInfo(resourcesRelativePath);
61-
var parent = new DirectoryInfo(@"Resources");
62-
63-
if (parent.Exists)
64-
{
65-
DirectoryHelper.DeleteSubdirectories(parent.FullName);
66-
}
67-
68-
DirectoryHelper.CopyFilesRecursively(source, ResourcesDirectory);
56+
const string sourceRelativePath = @"../../Resources";
57+
ResourcesDirectory = new DirectoryInfo(sourceRelativePath);
6958

7059
// Setup standard paths to our test repositories
71-
BareTestRepoPath = Path.Combine(resourcesRelativePath, "testrepo.git");
72-
StandardTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "testrepo_wd");
73-
StandardTestRepoPath = Path.Combine(StandardTestRepoWorkingDirPath, ".git");
74-
ShallowTestRepoPath = Path.Combine(resourcesRelativePath, "shallow.git");
75-
MergedTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "mergedrepo_wd");
76-
MergeRenamesTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "mergerenames_wd");
77-
MergeTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "merge_testrepo_wd");
78-
RevertTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "revert_testrepo_wd");
79-
SubmoduleTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "submodule_wd");
80-
SubmoduleTargetTestRepoWorkingDirPath = Path.Combine(resourcesRelativePath, "submodule_target_wd");
60+
BareTestRepoPath = Path.Combine(sourceRelativePath, "testrepo.git");
61+
StandardTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "testrepo_wd");
62+
StandardTestRepoPath = Path.Combine(StandardTestRepoWorkingDirPath, "dot_git");
63+
ShallowTestRepoPath = Path.Combine(sourceRelativePath, "shallow.git");
64+
MergedTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "mergedrepo_wd");
65+
MergeRenamesTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "mergerenames_wd");
66+
MergeTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "merge_testrepo_wd");
67+
RevertTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "revert_testrepo_wd");
68+
SubmoduleTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "submodule_wd");
69+
SubmoduleTargetTestRepoWorkingDirPath = Path.Combine(sourceRelativePath, "submodule_target_wd");
8170
}
8271

8372
private static bool IsFileSystemCaseSensitiveInternal()
8473
{
85-
var mixedPath = Path.Combine(Constants.TemporaryReposPath, "mIxEdCase");
74+
var mixedPath = Path.Combine(Constants.TemporaryReposPath, "mIxEdCase-" + Path.GetRandomFileName());
8675

8776
if (Directory.Exists(mixedPath))
8877
{

0 commit comments

Comments
 (0)