refactor(tests): Add strict type hints to final batch of test files
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from typing import Any
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch, call
|
||||
from models import Ticket, Track, WorkerContext
|
||||
@@ -33,7 +34,7 @@ async def test_headless_verification_full_run() -> None:
|
||||
assert mock_reset.call_count == 2
|
||||
|
||||
@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
|
||||
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
|
||||
import ai_client
|
||||
|
||||
def restore_client():
|
||||
def restore_client() -> None:
|
||||
ai_client._gemini_client = mock_genai_client
|
||||
mock_ensure.side_effect = restore_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 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:
|
||||
analysis = qa_callback("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:
|
||||
found_qa = True
|
||||
assert found_qa, "QA Analysis was not injected into the next round"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user