Fix tournament tests potentially using data left over from previous runs

This commit is contained in:
Dean Herbert
2021-11-23 14:38:37 +09:00
parent 8c24d6eb76
commit 4624977b77
3 changed files with 39 additions and 12 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
// don't use clean run because files are being written before osu! launches.
using (HeadlessGameHost host = new HeadlessGameHost(nameof(CheckIPCLocation)))
{
string basePath = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(CheckIPCLocation));
string basePath = CustomTourneyDirectoryTest.PrepareBasePath(nameof(CheckIPCLocation));
// Set up a fake IPC client for the IPC Storage to switch to.
string testStableInstallDirectory = Path.Combine(basePath, "stable-ce");
@ -42,9 +42,16 @@ namespace osu.Game.Tournament.Tests.NonVisual
}
finally
{
host.Storage.DeleteDirectory(testStableInstallDirectory);
host.Storage.DeleteDirectory("tournaments");
host.Exit();
try
{
if (Directory.Exists(basePath))
Directory.Delete(basePath, true);
}
catch
{
}
}
}
}