1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 12:17:46 +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

@ -25,8 +25,15 @@ namespace osu.Game.Tests
} }
protected override void SetupForRun() protected override void SetupForRun()
{
try
{ {
Storage.DeleteDirectory(string.Empty); 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 // 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. // log entries from another source if a unit test host is shared over multiple tests, causing a file access denied exception.