When using the InputTestFixture you need to use [SetUp] and [TearDown]. [OneTimeSetup] & [OneTimeTeardown] have different timing and won't work well with the InputTestFixture's lifecycle.
This is due to how the InputTestFixture mocks user input data and it's load / restore mechanism. Old data was restored in your repo project's case causing issues.
We have added documentation around this for an upcoming release to avoid confusion.
Here is also a minimal working test for this case that had the same scene setup used in the repo project. Copying this Setup / Teardown code should fix the issue for you.
Swapping between [OneTimeSetup] & [OneTimeTearDown] vs [SetUp] & [TearDown] with the same code should also reproduce / fix the error without the need for the workaround you provided also.
using System.Collections;
using NUnit.Framework;
using UnityEditor.SceneManagement;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
namespace Tests.InputSystem
{
public class SceneLoadingTests : InputTestFixture
{
private const string TestScenePath = "Assets/Tests/InputSystem/Assets/AutoSwitchBoolTestScene.unity";
private Scene m_Scene;
[SetUp]
public void SetUpTest()
{
m_Scene = EditorSceneManager.LoadSceneInPlayMode(TestScenePath, new LoadSceneParameters(LoadSceneMode.Additive));
}
[TearDown]
public void TearDown()
{
SceneManager.UnloadScene(m_Scene);
}
[UnityTest]
[Category("SceneLoading")]
public IEnumerator Users_CanLoadASceneWithPlayerInputAutoSwitchFlagSetToTrue_InTestsWithInputTestFixture()
{
yield return null;
}
}
}