Cleaning up upon a cancelled test

Hi,

I’ve noticed that when cancelling a test using the button in the test runner window it never hits the callback for IPostBuildCleanup which means I’m unable to restore some state, in this case its restoring the EditorSceneManager.playModeStartScene that I have stored in a static variable.

Is there anyway to detect a cancellation of a test?

Thanks.

public class BaseRuntimeTest : SceneTestFixture, IPrebuildSetup, IPostBuildCleanup
{
	private static SceneAsset s_startingScene;
	
	public void Setup()
	{
		s_startingScene = EditorSceneManager.playModeStartScene;
		EditorSceneManager.playModeStartScene = null;
	}
	
	public void Cleanup()
	{
		if (s_startingScene != null)
		{
			EditorSceneManager.playModeStartScene = s_startingScene;
			s_startingScene = null;
		}
	}
}