Skip to content

Commit bdd6184

Browse files
authored
fix: stop overwriting session mock during tests (#175)
1 parent 2fe8ba7 commit bdd6184

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/integration/run_tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ def log(msg):
1818
print(f"\033[36m[test-runner]\033[0m {msg}")
1919

2020

21+
def reset_session_fixture(test_home):
22+
"""Reset the session.json fixture to its committed state before tests.
23+
24+
The CLI may modify session.json during MCP operations (like team switching),
25+
so we restore it to the canonical committed version before each test run.
26+
"""
27+
session_file = test_home / ".config" / "tower" / "session.json"
28+
subprocess.run(
29+
["git", "checkout", str(session_file)],
30+
capture_output=True,
31+
)
32+
33+
2134
def check_mock_server_health(url):
2235
"""Check if the mock server is running and responding."""
2336
try:
@@ -129,6 +142,8 @@ def main():
129142
return 1
130143

131144
finally:
145+
reset_session_fixture(test_home)
146+
132147
if mock_process:
133148
log("Stopping mock server...")
134149
mock_process.terminate()

0 commit comments

Comments
 (0)