Moved temporary files into a folder of their own below the data directory (#1245)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-29 18:45:34 +01:00
1 parent ddfc632b63
commit 12d3e1ec6c
52 files changed
+1219 -396

No files matched your search

+20
View File
@@ -1,3 +1,5 @@
using AIStudio.Tools;
using Microsoft.Extensions.Logging.Abstractions;
//
@@ -11,9 +13,21 @@ namespace AIStudio.Tests;
[SetUpFixture]
public sealed class TestHost
{
/// <summary>
/// The data directory of the tests, below which TemporaryFiles keeps its folder.
/// </summary>
public static readonly string DATA_DIRECTORY = Path.Join(Path.GetTempPath(), $"ai-studio-tests-{Guid.NewGuid():N}");
[OneTimeSetUp]
public void PrepareStaticApplicationState() => PrepareStaticState();
[OneTimeTearDown]
public void DeleteDataDirectory()
{
if (Directory.Exists(DATA_DIRECTORY))
Directory.Delete(DATA_DIRECTORY, true);
}
/// <summary>
/// Fills the static state of the app which the tests need.
/// </summary>
@@ -31,5 +45,11 @@ public sealed class TestHost
// that writes nowhere is all it takes to get past that.
//
Program.LOGGER_FACTORY = NullLoggerFactory.Instance;
//
// The app sets its temporary folder below its data directory while it starts. The tests have no
// data directory, so the folder lies below one of their own:
//
TemporaryFiles.Initialize(DATA_DIRECTORY, NullLogger.Instance);
}
}