chore(tests): Final stabilization of test suite and full isolation of live_gui artifacts
This commit is contained in:
@@ -36,6 +36,7 @@ def test_event_emission() -> None:
|
||||
callback.assert_called_once_with(payload={"data": 123})
|
||||
|
||||
def test_send_emits_events_proper() -> None:
|
||||
ai_client.reset_session()
|
||||
with patch("ai_client._ensure_gemini_client"), \
|
||||
patch("ai_client._gemini_client") as mock_client:
|
||||
mock_chat = MagicMock()
|
||||
@@ -56,6 +57,7 @@ def test_send_emits_events_proper() -> None:
|
||||
assert kwargs['payload']['provider'] == 'gemini'
|
||||
|
||||
def test_send_emits_tool_events() -> None:
|
||||
ai_client.reset_session() # Clear caches and chats to avoid test pollution
|
||||
with patch("ai_client._ensure_gemini_client"), \
|
||||
patch("ai_client._gemini_client") as mock_client, \
|
||||
patch("mcp_client.dispatch") as mock_dispatch:
|
||||
@@ -76,8 +78,12 @@ def test_send_emits_tool_events() -> None:
|
||||
mock_dispatch.return_value = "file content"
|
||||
ai_client.set_provider("gemini", "gemini-2.5-flash-lite")
|
||||
tool_callback = MagicMock()
|
||||
ai_client.events.on("tool_execution", tool_callback)
|
||||
ai_client.send("context", "message")
|
||||
def debug_tool(*args, **kwargs):
|
||||
print(f"DEBUG_TOOL_EVENT: {args} {kwargs}")
|
||||
tool_callback(*args, **kwargs)
|
||||
ai_client.events.on("tool_execution", debug_tool)
|
||||
result = ai_client.send("context", "message")
|
||||
print(f"DEBUG_RESULT: {result}")
|
||||
# Should be called twice: once for 'started', once for 'completed'
|
||||
assert tool_callback.call_count == 2
|
||||
# Check 'started' call
|
||||
|
||||
Reference in New Issue
Block a user