Skip to content

Commit e515655

Browse files
committed
Fix test teardown to avoid dropping MCP bridge
CodexConfigHelperTests was calling MCPServiceLocator.Reset() in TearDown, which disposes the active bridge/transport during MCP-driven test runs. Replace with restoring only the mutated service (IPlatformService).
1 parent 8e3bd1d commit e515655

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/CodexConfigHelperTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ public void SetUp()
5454
[TearDown]
5555
public void TearDown()
5656
{
57-
// Reset service locator after each test
58-
MCPServiceLocator.Reset();
57+
// IMPORTANT:
58+
// These tests can be executed while an MCP session is active (e.g., when running tests via MCP).
59+
// MCPServiceLocator.Reset() disposes the bridge + transport manager, which can kill the MCP connection
60+
// mid-run. Instead, restore only what this fixture mutates.
61+
MCPServiceLocator.Register<IPlatformService>(new PlatformService());
5962
}
6063

6164
[OneTimeTearDown]

0 commit comments

Comments
 (0)