fix(tests): reset_paths fixture should not clear at teardown (breaks atexit callbacks)

This commit is contained in:
ed
2026-06-19 10:59:18 -04:00
parent e1d4c1dc9d
commit 4dd48f1e8a
+5 -6
View File
@@ -423,15 +423,14 @@ def isolate_workspace(monkeypatch) -> Generator[None, None, None]:
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def reset_paths() -> Generator[None, None, None]: def reset_paths() -> Generator[None, None, None]:
""" """
Autouse fixture that resets the paths singleton before each test. Autouse marker fixture. No-op at setup AND teardown — PathsConfig is
The isolate_workspace fixture re-initializes paths before the test runs, frozen at init time, and clearing it would break atexit callbacks
so reset_paths is a no-op here (PathsConfig is frozen at init time, (e.g., session_logger.close_session) that fire after pytest finishes.
the per-getter cache is gone). Kept as a marker for backward compatibility If a test needs a fresh paths graph, it must call paths.initialize_paths()
with test code that asserts the singleton is cleared at test boundaries. explicitly. See src/paths.py docstring for the explicit-init contract.
""" """
from src import paths from src import paths
yield yield
paths.reset_paths()
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def reset_ai_client() -> Generator[None, None, None]: def reset_ai_client() -> Generator[None, None, None]: