From 9f7c6adb5849777f77de6ba48c129bf8b53fd130 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Jul 2021 12:15:28 +0900 Subject: [PATCH] Fix test failures due to logger pollution As seen at https://github.com/ppy/osu/pull/13831/checks?check_run_id=3025050307. I can't confirm that this will fix the issue but it looks like the only plausible reason. I have confirmed that the logging is not coming from the local (first logging is guaranteed to be after `SetupForRun`). --- osu.Game/Tests/CleanRunHeadlessGameHost.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/CleanRunHeadlessGameHost.cs b/osu.Game/Tests/CleanRunHeadlessGameHost.cs index baa7b27d28..03ab94d1da 100644 --- a/osu.Game/Tests/CleanRunHeadlessGameHost.cs +++ b/osu.Game/Tests/CleanRunHeadlessGameHost.cs @@ -25,8 +25,11 @@ namespace osu.Game.Tests protected override void SetupForRun() { - base.SetupForRun(); Storage.DeleteDirectory(string.Empty); + + // 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. + base.SetupForRun(); } } }