1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Protect against test failures due to logger being set too early (and beginning logging)

This commit is contained in:
Dean Herbert 2021-12-24 23:55:08 +09:00
parent a9a7a33974
commit 7088471cad

View File

@ -26,7 +26,14 @@ namespace osu.Game.Tests
protected override void SetupForRun()
{
Storage.DeleteDirectory(string.Empty);
try
{
Storage.DeleteDirectory(string.Empty);
}
catch
{
// May fail if a logging target has already been set via OsuStorage.ChangeTargetStorage.
}
// base call needs to be run *after* storage is emptied, as it updates the (static) logger's storage and may start writing
// log entries from another source if a unit test host is shared over multiple tests, causing a file access denied exception.