From 59da3261f920ea2395dccdda93277e69af1575ae Mon Sep 17 00:00:00 2001 From: Alex Kroman Date: Mon, 8 Jun 2026 07:43:29 -0700 Subject: [PATCH] Annotate test functions to clear mypy annotation-unchecked notes These 14 test functions carried variable annotations in otherwise-untyped bodies, so mypy skipped their bodies and emitted annotation-unchecked notes. Adding `-> None` return annotations makes mypy type-check the bodies, clearing the notes. Tests stay exempt from requiring return annotations elsewhere; this only annotates the functions that already had body-level annotations. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_agent_audio.py | 4 ++-- tests/test_agent_session.py | 2 +- tests/test_code_gen.py | 2 +- tests/test_doctor.py | 4 ++-- tests/test_init_template_contract.py | 2 +- tests/test_microphone.py | 8 ++++---- tests/test_setup_render.py | 2 +- tests/test_steps.py | 2 +- tests/test_stream_session.py | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_agent_audio.py b/tests/test_agent_audio.py index c966b91e..916c4ca5 100644 --- a/tests/test_agent_audio.py +++ b/tests/test_agent_audio.py @@ -159,7 +159,7 @@ def test_null_player_is_a_noop_player(): p.close() # none of these raise or open a device -def test_default_duplex_stream_opens_started_rawstream(monkeypatch): +def test_default_duplex_stream_opens_started_rawstream(monkeypatch) -> None: created = {} class FakeRaw: @@ -188,7 +188,7 @@ def test_default_duplex_stream_missing_sounddevice_raises_mic_missing(monkeypatc assert exc.value.error_type == "mic_missing" -def test_default_duplex_stream_open_failure_raises_audio_output_error(monkeypatch): +def test_default_duplex_stream_open_failure_raises_audio_output_error(monkeypatch) -> None: def boom(**kw): raise OSError("device busy") diff --git a/tests/test_agent_session.py b/tests/test_agent_session.py index 1bd32c7b..486216a7 100644 --- a/tests/test_agent_session.py +++ b/tests/test_agent_session.py @@ -430,7 +430,7 @@ def close(self): assert ("user_final", "SHOULD NOT BE SEEN") not in finals # stopped after the reply -def test_run_session_ws_url_follows_active_environment(): +def test_run_session_ws_url_follows_active_environment() -> None: # The Voice Agent socket must target the active environment's host, not a # hardcoded production URL. Capture the URL connect() is handed, short- # circuiting with a benign close once we've seen it. diff --git a/tests/test_code_gen.py b/tests/test_code_gen.py index 0dcf984c..c92d26b5 100644 --- a/tests/test_code_gen.py +++ b/tests/test_code_gen.py @@ -278,7 +278,7 @@ class _Stub: content_safety: ClassVar[object] = type("CS", (), {"summary": {"profanity": 0.1}})() -def test_every_snippet_execs_against_a_realistic_transcript(): +def test_every_snippet_execs_against_a_realistic_transcript() -> None: # Enable every feature so result_handling emits all snippets, then exec them. all_on: dict[str, object] = { "speaker_labels": True, diff --git a/tests/test_doctor.py b/tests/test_doctor.py index 95205905..cb9dc0e0 100644 --- a/tests/test_doctor.py +++ b/tests/test_doctor.py @@ -162,7 +162,7 @@ def query_devices(self): assert doctor._probe_input_devices() == 1 -def test_render_ok_payload_shows_ready(): +def test_render_ok_payload_shows_ready() -> None: payload: doctor.DoctorResult = { "ok": True, "checks": [ @@ -174,7 +174,7 @@ def test_render_ok_payload_shows_ready(): assert "Everything looks good." in text -def test_render_problem_payload_shows_fix_and_problem_banner(): +def test_render_problem_payload_shows_fix_and_problem_banner() -> None: payload: doctor.DoctorResult = { "ok": False, "checks": [ diff --git a/tests/test_init_template_contract.py b/tests/test_init_template_contract.py index 7261f0b1..3f001761 100644 --- a/tests/test_init_template_contract.py +++ b/tests/test_init_template_contract.py @@ -85,7 +85,7 @@ def test_frontend_routes_exist_in_backend(template_dir): ) -def test_requirements_cover_backend_imports(template_dir): +def test_requirements_cover_backend_imports(template_dir) -> None: """Every third-party import in api/*.py appears in requirements.txt.""" imports: set[str] = set() for path in (template_dir / "api").glob("*.py"): diff --git a/tests/test_microphone.py b/tests/test_microphone.py index b06872de..1a26fe6b 100644 --- a/tests/test_microphone.py +++ b/tests/test_microphone.py @@ -162,7 +162,7 @@ def fake_factory(*, sample_rate, device): assert seen["rate"] == 32000 -def test_device_default_rate_reads_device(monkeypatch): +def test_device_default_rate_reads_device(monkeypatch) -> None: fake_sd: Any = types.ModuleType("sounddevice") fake_sd.query_devices = lambda device, kind: {"default_samplerate": 44100.0} monkeypatch.setitem(sys.modules, "sounddevice", fake_sd) @@ -182,7 +182,7 @@ def test_resample_pcm16_uses_16bit_mono_params(): assert out != chunk # 48k -> 24k actually changes the data -def test_device_default_rate_falls_back_on_query_error(monkeypatch): +def test_device_default_rate_falls_back_on_query_error(monkeypatch) -> None: fake_sd: Any = types.ModuleType("sounddevice") def boom(*a, **k): @@ -193,7 +193,7 @@ def boom(*a, **k): assert _device_default_rate(None) == _FALLBACK_RATE -def test_device_default_rate_falls_back_on_non_numeric_rate(monkeypatch): +def test_device_default_rate_falls_back_on_non_numeric_rate(monkeypatch) -> None: fake_sd: Any = types.ModuleType("sounddevice") fake_sd.query_devices = lambda device, kind: {"default_samplerate": object()} monkeypatch.setitem(sys.modules, "sounddevice", fake_sd) @@ -210,7 +210,7 @@ def test_sounddevice_mic_yields_bytes_then_stops_and_closes(): assert stream.stopped and stream.closed -def test_default_mic_stream_opens_started_sounddevice_stream(monkeypatch): +def test_default_mic_stream_opens_started_sounddevice_stream(monkeypatch) -> None: created = {} def raw_input_stream(**kwargs): diff --git a/tests/test_setup_render.py b/tests/test_setup_render.py index 073b945e..7b3c3c24 100644 --- a/tests/test_setup_render.py +++ b/tests/test_setup_render.py @@ -5,7 +5,7 @@ from aai_cli.steps import Step -def test_render_steps_colors_status(): +def test_render_steps_colors_status() -> None: data: dict[str, list[Step]] = { "steps": [ {"name": "mcp", "status": "installed", "detail": "/path"}, diff --git a/tests/test_steps.py b/tests/test_steps.py index 1d420739..100d9cf3 100644 --- a/tests/test_steps.py +++ b/tests/test_steps.py @@ -1,7 +1,7 @@ from aai_cli import steps -def test_render_steps_includes_name_status_detail(): +def test_render_steps_includes_name_status_detail() -> None: data: list[steps.Step] = [ {"name": "scaffold", "status": "created", "detail": "./my-app"}, {"name": "install", "status": "skipped", "detail": "--no-install"}, diff --git a/tests/test_stream_session.py b/tests/test_stream_session.py index 6b043c98..70440533 100644 --- a/tests/test_stream_session.py +++ b/tests/test_stream_session.py @@ -83,7 +83,7 @@ def boom(*_args, **_kwargs): assert closed["n"] >= 1 -def test_stream_system_audio_uses_macos_source(monkeypatch): +def test_stream_system_audio_uses_macos_source(monkeypatch) -> None: config.set_api_key("default", "sk_live") source_types: list[str] = [] rates: list[int] = []