diff --git a/tests/mock_concurrent_mma.py b/tests/mock_concurrent_mma.py index 79648936..3b293b59 100644 --- a/tests/mock_concurrent_mma.py +++ b/tests/mock_concurrent_mma.py @@ -37,7 +37,7 @@ def main() -> None: prompt = "" # Detect the session we're "resuming" via --resume arg (set by the - # gemini_cli_adapter on subsequent calls). + # mock on subsequent calls). session_id = "" argv = sys.argv[1:] if "--resume" in argv: @@ -77,7 +77,7 @@ def main() -> None: # CHECK BEFORE epic so worker takes priority over the catch-all epic branch. if 'You are assigned to Ticket' in prompt: # NOTE: Removed session_id.startswith("mock-worker-") fallback. The session_id - # persists across tests in the same session (gemini_cli_adapter is a singleton). + # persists across tests in the same session (mock provider is stateful). # The fallback caused test_mma_concurrent_tracks_stress_sim to fail when it ran # AFTER test_mma_concurrent_tracks_execution: the execution test set the session_id # to mock-worker-ticket-A-1, and the stress test's epic call used --resume with that diff --git a/tests/test_ai_client_tool_loop_send_func.py b/tests/test_ai_client_tool_loop_send_func.py index 6f270139..72863845 100644 --- a/tests/test_ai_client_tool_loop_send_func.py +++ b/tests/test_ai_client_tool_loop_send_func.py @@ -1,5 +1,5 @@ """Verify run_with_tool_loop supports a custom send_func for vendors -that don't use send_openai_compatible (gemini_cli, gemini, anthropic, +that don't use send_openai_compatible (gemini, anthropic, deepseek). The vendor provides a send_func that returns a NormalizedResponse, and the helper handles history + dispatch. """ diff --git a/tests/test_ai_loop_regressions_20260614.py b/tests/test_ai_loop_regressions_20260614.py index 6a58f8e5..ac3169be 100644 --- a/tests/test_ai_loop_regressions_20260614.py +++ b/tests/test_ai_loop_regressions_20260614.py @@ -63,12 +63,9 @@ def test_fr1_error_becomes_discussion_entry(mock_app: App, monkeypatch: pytest.M monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None) - monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "") monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) - monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None) _drain_queue(app) - app.controller._handle_request_event(_make_event()) - events = _drain_queue(app) + response_events = [p for n, p in events if n == "response"] assert response_events, "No 'response' event was queued for the error case" payload = response_events[-1] @@ -94,11 +91,11 @@ def test_fr1_success_still_works(mock_app: App, monkeypatch: pytest.MonkeyPatch) monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "") monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) - monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None) + monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) _drain_queue(app) app.controller._handle_request_event(_make_event()) events = _drain_queue(app) - response_events = [p for n, p in events if n == "response"] + assert response_events, "No 'response' event was queued for the success case" payload = response_events[-1] assert payload["status"] == "done", f"Expected status='done', got {payload.get('status')!r}" @@ -119,13 +116,13 @@ def test_fr1_ai_status_updated(mock_app: App, monkeypatch: pytest.MonkeyPatch) - monkeypatch.setattr(ai_client, "set_project_context_marker", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_model_params", lambda *a, **kw: None) monkeypatch.setattr(ai_client, "set_agent_tools", lambda *a, **kw: None) - monkeypatch.setattr(ai_client, "set_current_tier", lambda *a, **kw: None) - monkeypatch.setattr(ai_client, "get_combined_system_prompt", lambda *a, **kw: "") monkeypatch.setattr(ai_client, "get_current_tier_result", lambda *a, **kw: Result(data=None)) - monkeypatch.setattr("src.app_controller.AppController._update_gcli_adapter", lambda *a, **kw: None) _drain_queue(app) app.controller._handle_request_event(_make_event()) status = app.controller.ai_status + + app.controller._handle_request_event(_make_event()) + status = app.controller.ai_status assert status.startswith("error:"), f"Expected ai_status to start with 'error:', got {status!r}" assert "slow down" in status, f"Expected error message in status, got {status!r}" diff --git a/tests/test_lazymodule_filedialog_fallback.py b/tests/test_lazymodule_filedialog_fallback.py index a85324b3..7d1ec0d9 100644 --- a/tests/test_lazymodule_filedialog_fallback.py +++ b/tests/test_lazymodule_filedialog_fallback.py @@ -7,7 +7,7 @@ the `tkinter.filedialog` sub-module fails to load. The original `_LazyModule` in src/gui_2.py used `getattr(tkinter, 'filedialog')` which raises a confusing AttributeError at the call site. With 14 call sites in render_projects_panel, render_workspace_settings_hub, render_fonts_panel, -and render_gemini_cli_settings, this AttributeError spammed the GUI's +this AttributeError spammed the GUI's stderr at 60fps whenever the Project Settings window was open. The fix must make `_LazyModule` fall back to a stub that mimics diff --git a/tests/test_live_gui_integration_v2.py b/tests/test_live_gui_integration_v2.py index 13ab304c..92490b2f 100644 --- a/tests/test_live_gui_integration_v2.py +++ b/tests/test_live_gui_integration_v2.py @@ -29,8 +29,7 @@ def test_user_request_integration_flow(mock_app: App) -> None: patch('src.ai_client.send', return_value=Result(data=mock_response)) as mock_send, patch('src.ai_client.set_custom_system_prompt'), patch('src.ai_client.set_model_params'), - patch('src.ai_client.set_agent_tools'), - patch('src.app_controller.AppController._update_gcli_adapter') + patch('src.ai_client.set_agent_tools') ): # 1. Create and push a UserRequestEvent event = UserRequestEvent( @@ -88,8 +87,7 @@ def test_user_request_error_handling(mock_app: App) -> None: patch('src.ai_client.send', return_value=Result(data="", errors=[err])), patch('src.ai_client.set_custom_system_prompt'), patch('src.ai_client.set_model_params'), - patch('src.ai_client.set_agent_tools'), - patch('src.app_controller.AppController._update_gcli_adapter') + patch('src.ai_client.set_agent_tools') ): event = UserRequestEvent( prompt="Trigger Error",