Skip to content

Commit

Permalink
Merge pull request #6522 from peppy/fix-solo-pollution
Browse files Browse the repository at this point in the history
Fix `[Solo]` attributes getting committed by blocking from NUnit runs
  • Loading branch information
bdach authored Feb 7, 2025
2 parents 82f37c8 + eaf9c29 commit 62b98aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions osu.Framework/Testing/TestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ public override void BeforeTest(ITest test)
if (test.Fixture is not TestScene testScene)
return;

bool hasSoloAttribute = test.Method?.MethodInfo.CustomAttributes.Any(a => a.AttributeType == typeof(SoloAttribute)) == true;
if (DebugUtils.IsNUnitRunning && hasSoloAttribute)
throw new InvalidOperationException($"{nameof(SoloAttribute)} should not be specified on tests running under NUnit.");

// Since the host is created in OneTimeSetUp, all game threads will have the fixture's execution context
// This is undesirable since each test is run using those same threads, so we must make sure the execution context
// for the game threads refers to the current _test_ execution context for each test
Expand Down

0 comments on commit 62b98aa

Please sign in to comment.