Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2015-04-29 22:48:08 +0300
committernulltoken <emeric.fermas@gmail.com>2015-04-29 22:48:08 +0300
commit0b3109048f0ec3ac8fd991370c40aba69526f742 (patch)
treee63242febcd11abf99564f18910f9c0f157579cd /LibGit2Sharp.Tests
parent8febb35461b3391851df7ec9ca25c34313e70a9c (diff)
parentb5223d5ca82a8cb39d3cd7d7fae829ef286cc5be (diff)
Merge pull request #1035 from whoisj/custom-unit-test-folder
Enable custom unit test location with standard location fallback
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/TestHelpers/Constants.cs20
1 files changed, 17 insertions, 3 deletions
diff --git a/LibGit2Sharp.Tests/TestHelpers/Constants.cs b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
index 954ed6aa..450746ff 100644
--- a/LibGit2Sharp.Tests/TestHelpers/Constants.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
using System.IO;
namespace LibGit2Sharp.Tests.TestHelpers
@@ -34,7 +35,7 @@ namespace LibGit2Sharp.Tests.TestHelpers
public static string BuildPath()
{
- string tempPath;
+ string tempPath = null;
var unixPath = Type.GetType("Mono.Unix.UnixPath, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
@@ -48,11 +49,24 @@ namespace LibGit2Sharp.Tests.TestHelpers
}
else
{
+ const string LibGit2TestPath = "LibGit2TestPath";
// We're running on .Net/Windows
- tempPath = Path.GetTempPath();
+ if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
+ {
+ Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
+ tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
+ }
+
+ if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
+ {
+ Trace.TraceInformation("Using default test path value");
+ tempPath = Path.GetTempPath();
+ }
}
- return Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
+ string testWorkingDirectory = Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
+ Trace.TraceInformation("Test working directory set to '{0}'", testWorkingDirectory);
+ return testWorkingDirectory;
}
}
}