Merge pull request #15094 from dotnet/marcpopMSFT-cleanupnugets
Delete some test folders once run to not leave them on the machine
This commit is contained in:
commit
ffda9745d6
1 changed files with 14 additions and 2 deletions
|
@ -234,6 +234,12 @@ namespace EndToEnd.Tests
|
|||
//check if the template created files
|
||||
Assert.True(directory.Exists);
|
||||
Assert.True(directory.EnumerateFileSystemInfos().Any());
|
||||
|
||||
// delete test directory for some tests so we aren't leaving behind non-compliant nuget files
|
||||
if (templateName.Equals("nugetconfig"))
|
||||
{
|
||||
directory.Delete(true);
|
||||
}
|
||||
}
|
||||
|
||||
[WindowsOnlyTheory]
|
||||
|
@ -317,7 +323,7 @@ namespace EndToEnd.Tests
|
|||
public void ItCanCreateTemplateWithDefaultFramework(string templateName)
|
||||
{
|
||||
string framework = DetectExpectedDefaultFramework(templateName);
|
||||
TestTemplateCreateAndBuild(templateName, build: false, framework: framework);
|
||||
TestTemplateCreateAndBuild(templateName, build: false, framework: framework, deleteTestDirectory: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -401,7 +407,7 @@ namespace EndToEnd.Tests
|
|||
throw new Exception("Unsupported version of SDK");
|
||||
}
|
||||
|
||||
private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "")
|
||||
private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "", bool deleteTestDirectory = false)
|
||||
{
|
||||
DirectoryInfo directory = TestAssets.CreateTestDirectory(identifier: string.IsNullOrWhiteSpace(language) ? templateName : $"{templateName}[{language}]");
|
||||
string projectDirectory = directory.FullName;
|
||||
|
@ -454,6 +460,12 @@ namespace EndToEnd.Tests
|
|||
.Execute(buildArgs)
|
||||
.Should().Pass();
|
||||
}
|
||||
|
||||
// delete test directory for some tests so we aren't leaving behind non-compliant package files
|
||||
if (deleteTestDirectory)
|
||||
{
|
||||
directory.Delete(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue