refactor(tests): Add strict type hints to final batch of test files

This commit is contained in:
2026-02-28 19:31:19 -05:00
parent f5e43c7987
commit 7a0e8e6366
7 changed files with 11 additions and 13 deletions

View File

@@ -7,6 +7,5 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import ai_client import ai_client
def test_agent_capabilities_listing(): def test_agent_capabilities_listing() -> None:
# Verify that the agent exposes its available tools correctly
pass pass

View File

@@ -40,8 +40,7 @@ def test_has_cycle_indirect_cycle() -> None:
dag = TrackDAG([t1, t2, t3]) dag = TrackDAG([t1, t2, t3])
assert dag.has_cycle() assert dag.has_cycle()
def test_has_cycle_complex_no_cycle(): def test_has_cycle_complex_no_cycle() -> None:
# T1 -> T2, T1 -> T3, T2 -> T4, T3 -> T4
t1 = Ticket(id="T1", description="T1", status="todo", assigned_to="worker", depends_on=["T2", "T3"]) t1 = Ticket(id="T1", description="T1", status="todo", assigned_to="worker", depends_on=["T2", "T3"])
t2 = Ticket(id="T2", description="T2", status="todo", assigned_to="worker", depends_on=["T4"]) t2 = Ticket(id="T2", description="T2", status="todo", assigned_to="worker", depends_on=["T4"])
t3 = Ticket(id="T3", description="T3", status="todo", assigned_to="worker", depends_on=["T4"]) t3 = Ticket(id="T3", description="T3", status="todo", assigned_to="worker", depends_on=["T4"])

View File

@@ -2,8 +2,7 @@ import pytest
from models import Ticket from models import Ticket
from dag_engine import TrackDAG, ExecutionEngine from dag_engine import TrackDAG, ExecutionEngine
def test_execution_engine_basic_flow(): def test_execution_engine_basic_flow() -> None:
# Setup tickets with dependencies
t1 = Ticket(id="T1", description="Task 1", status="todo", assigned_to="worker") t1 = Ticket(id="T1", description="Task 1", status="todo", assigned_to="worker")
t2 = Ticket(id="T2", description="Task 2", status="todo", assigned_to="worker", depends_on=["T1"]) t2 = Ticket(id="T2", description="Task 2", status="todo", assigned_to="worker", depends_on=["T1"])
t3 = Ticket(id="T3", description="Task 3", status="todo", assigned_to="worker", depends_on=["T1"]) t3 = Ticket(id="T3", description="Task 3", status="todo", assigned_to="worker", depends_on=["T1"])

View File

@@ -1,3 +1,4 @@
from typing import Any
import pytest import pytest
from unittest.mock import MagicMock, patch, call from unittest.mock import MagicMock, patch, call
from models import Ticket, Track, WorkerContext from models import Ticket, Track, WorkerContext
@@ -33,7 +34,7 @@ async def test_headless_verification_full_run() -> None:
assert mock_reset.call_count == 2 assert mock_reset.call_count == 2
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_headless_verification_error_and_qa_interceptor(): async def test_headless_verification_error_and_qa_interceptor() -> None:
""" """
5. Simulate a shell error and verify that the Tier 4 QA interceptor is triggered 5. Simulate a shell error and verify that the Tier 4 QA interceptor is triggered
and its summary is injected into the worker's history for the next retry. and its summary is injected into the worker's history for the next retry.
@@ -54,7 +55,7 @@ async def test_headless_verification_error_and_qa_interceptor():
# Ensure _gemini_client is restored by the mock ensure function # Ensure _gemini_client is restored by the mock ensure function
import ai_client import ai_client
def restore_client(): def restore_client() -> None:
ai_client._gemini_client = mock_genai_client ai_client._gemini_client = mock_genai_client
mock_ensure.side_effect = restore_client mock_ensure.side_effect = restore_client
ai_client._gemini_client = mock_genai_client ai_client._gemini_client = mock_genai_client
@@ -86,7 +87,7 @@ async def test_headless_verification_error_and_qa_interceptor():
mock_chat.send_message.side_effect = [mock_resp1, mock_resp2] mock_chat.send_message.side_effect = [mock_resp1, mock_resp2]
# Mock run_powershell behavior: it should call the qa_callback on error # Mock run_powershell behavior: it should call the qa_callback on error
def run_side_effect(script, base_dir, qa_callback): def run_side_effect(script: Any, base_dir: Any, qa_callback: Any) -> Any:
if qa_callback: if qa_callback:
analysis = qa_callback("Error: file not found") analysis = qa_callback("Error: file not found")
return f"""STDERR: Error: file not found return f"""STDERR: Error: file not found
@@ -117,3 +118,4 @@ QA ANALYSIS:
if "QA ANALYSIS:" in part_str and "FIX: Check if path exists." in part_str: if "QA ANALYSIS:" in part_str and "FIX: Check if path exists." in part_str:
found_qa = True found_qa = True
assert found_qa, "QA Analysis was not injected into the next round" assert found_qa, "QA Analysis was not injected into the next round"

View File

@@ -8,8 +8,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import mcp_client import mcp_client
def test_mcp_perf_tool_retrieval(): def test_mcp_perf_tool_retrieval() -> None:
# Test that the MCP tool can call performance_monitor metrics
mock_metrics = {"fps": 60, "last_frame_time_ms": 16.6} mock_metrics = {"fps": 60, "last_frame_time_ms": 16.6}
# Simulate tool call by patching the callback # Simulate tool call by patching the callback
with patch('mcp_client.perf_monitor_callback', return_value=mock_metrics): with patch('mcp_client.perf_monitor_callback', return_value=mock_metrics):

View File

@@ -8,7 +8,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from simulation.sim_ai_settings import AISettingsSimulation from simulation.sim_ai_settings import AISettingsSimulation
def test_ai_settings_simulation_run(): def test_ai_settings_simulation_run() -> None:
mock_client = MagicMock() mock_client = MagicMock()
mock_client.wait_for_server.return_value = True mock_client.wait_for_server.return_value = True
mock_client.get_value.side_effect = lambda key: { mock_client.get_value.side_effect = lambda key: {

View File

@@ -8,7 +8,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from simulation.sim_execution import ExecutionSimulation from simulation.sim_execution import ExecutionSimulation
def test_execution_simulation_run(): def test_execution_simulation_run() -> None:
mock_client = MagicMock() mock_client = MagicMock()
mock_client.wait_for_server.return_value = True mock_client.wait_for_server.return_value = True
# Mock show_confirm_modal state # Mock show_confirm_modal state