fix(tests): resolve 3 test failures in GUI decoupling track

- conftest.py: Create workspace dir before writing files (FileNotFoundError)
- test_live_gui_integration.py: Call handler directly since start_services mocked
- test_gui2_performance.py: Fix key mismatch (gui_2.py -> sloppy.py path lookup)
This commit is contained in:
2026-03-04 22:00:00 -05:00
parent 2d92674aa0
commit 45b716f0f0
4 changed files with 29 additions and 18 deletions

View File

@@ -31,13 +31,10 @@ async def test_user_request_integration_flow(mock_app: App) -> None:
disc_text="History",
base_dir="."
)
# 2. Push event to the app's internal loop
await app.event_queue.put("user_request", event)
# 3. Wait for ai_client.send to be called (polling background thread)
start_time = time.time()
while not mock_send.called and time.time() - start_time < 5:
await asyncio.sleep(0.1)
assert mock_send.called, "ai_client.send was not called within timeout"
# 2. Call the handler directly since start_services is mocked (no event loop thread)
app.controller._handle_request_event(event)
# 3. Verify ai_client.send was called
assert mock_send.called, "ai_client.send was not called"
mock_send.assert_called_once_with(
"Context", "Hello AI", ".", [], "History",
pre_tool_callback=ANY,
@@ -77,7 +74,7 @@ async def test_user_request_error_handling(mock_app: App) -> None:
disc_text="",
base_dir="."
)
await app.event_queue.put("user_request", event)
app.controller._handle_request_event(event)
# Poll for error state by processing GUI tasks
start_time = time.time()
success = False