Private
Public Access
0
0

fix(sim): defensive .setdefault('paths', []) in test_context_sim_live

This commit is contained in:
2026-06-10 11:33:15 -04:00
parent c729f8adaf
commit 4660b8c874
4 changed files with 26 additions and 79 deletions
+3 -12
View File
@@ -368,19 +368,10 @@ class ApiHookClient:
instead of blind-polling the project state.
[C: tests/test_api_hooks_project_switch.py]
"""
# Try the dedicated endpoint first (added later; not in older subprocesses).
result = self._make_request('GET', '/api/project_switch_status')
if result and isinstance(result, dict) and 'in_progress' in result:
return result
# Fallback: read from /api/gui/state which has existed since the
# initial live_gui fixture. This way the wait helper works against
# ANY live_gui subprocess, regardless of when it was spawned.
state = self._make_request('GET', '/api/gui/state') or {}
return {
"in_progress": bool(state.get('_project_switch_in_progress', False)),
"path": state.get('active_project_path'),
"error": state.get('_project_switch_error'),
}
if not result or not isinstance(result, dict):
return {"in_progress": False, "path": None, "error": None}
return result
def wait_for_project_switch(self, expected_path: str = None, timeout: float = 30.0, poll_interval: float = 0.2) -> dict[str, Any]:
"""