[chore] remove all remaining type:ignore suppressions from tests/

Converts 115 `# type: ignore[...]` suppressions across 23 test files to
no-suppression patterns (helper-return widening to Any, local Any aliases,
cc:Any aliases, cast at narrow call sites, typed fixtures) so the hard
no-type:ignore convention holds across tests/. No test logic or assertions
changed — only mock-wiring mechanics and type annotations.

Gate: ruff check tests/ clean; mypy tests/ (538 files) clean; 176 changed-file
tests pass. Zero real suppressions remain (the 7 grep hits are 3 hygiene-
checker string-literal test inputs and 4 prose mentions in comments).
This commit is contained in:
Renn F
2026-06-28 17:00:20 +02:00
parent 4d4bf084c5
commit f826285651
23 changed files with 177 additions and 175 deletions
@@ -8,7 +8,7 @@ or committing/pushing. Fail-safe: a null/failing command returns False.
from __future__ import annotations
import subprocess
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, MagicMock
import pytest
@@ -36,9 +36,9 @@ def _make_read_clone(tmp_path: Path) -> Path:
return repo
def _svc(read_clone: Path) -> WorkspaceService:
svc = WorkspaceService.__new__(WorkspaceService)
svc.ensure_read_clone = AsyncMock(return_value=read_clone) # type: ignore[method-assign]
def _svc(read_clone: Path) -> Any:
svc: Any = WorkspaceService.__new__(WorkspaceService)
svc.ensure_read_clone = AsyncMock(return_value=read_clone)
return svc
@@ -7,12 +7,17 @@ class. The migration drops the unused one with a safety check.
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from sqlalchemy import text
if TYPE_CHECKING:
from sqlalchemy.ext.asyncio import AsyncSession
@pytest.mark.asyncio
async def test_no_column_uses_role_type(db_session) -> None: # type: ignore[no-untyped-def]
async def test_no_column_uses_role_type(db_session: AsyncSession) -> None:
"""Before dropping, confirm no column actually uses the `role` type.
If this ever fails it means a column was added that references the
@@ -33,7 +38,7 @@ async def test_no_column_uses_role_type(db_session) -> None: # type: ignore[no-
@pytest.mark.asyncio
async def test_role_enum_dropped_after_upgrade(db_session) -> None: # type: ignore[no-untyped-def]
async def test_role_enum_dropped_after_upgrade(db_session: AsyncSession) -> None:
"""After migration 013 runs, only `agentrole` remains; `role` is gone."""
# This test runs against a db where migrations have been applied to head.
# The conftest fixture should handle that — verify by reading the
@@ -7,12 +7,17 @@ tracking, RAG context). Only pm_approvals is truly orphaned.
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from sqlalchemy import text
if TYPE_CHECKING:
from sqlalchemy.ext.asyncio import AsyncSession
@pytest.mark.asyncio
async def test_pm_approvals_dropped(db_session) -> None: # type: ignore[no-untyped-def]
async def test_pm_approvals_dropped(db_session: AsyncSession) -> None:
"""pm_approvals column is gone from the tasks table."""
result = await db_session.execute(
text(
@@ -25,7 +30,9 @@ async def test_pm_approvals_dropped(db_session) -> None: # type: ignore[no-unty
@pytest.mark.asyncio
async def test_quick_context_and_proactive_context_remain(db_session) -> None: # type: ignore[no-untyped-def]
async def test_quick_context_and_proactive_context_remain(
db_session: AsyncSession,
) -> None:
"""quick_context and proactive_context MUST remain — they're actively used."""
result = await db_session.execute(
text(
@@ -10,12 +10,17 @@ discipline); these assertions guard the resulting schema shape.
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from sqlalchemy import text
if TYPE_CHECKING:
from sqlalchemy.ext.asyncio import AsyncSession
@pytest.mark.asyncio
async def test_revision_count_defaults_to_zero(db_session) -> None: # type: ignore[no-untyped-def]
async def test_revision_count_defaults_to_zero(db_session: AsyncSession) -> None:
result = await db_session.execute(
text(
"SELECT column_default, is_nullable "
@@ -30,7 +35,7 @@ async def test_revision_count_defaults_to_zero(db_session) -> None: # type: ign
@pytest.mark.asyncio
async def test_audit_log_query_index_exists(db_session) -> None: # type: ignore[no-untyped-def]
async def test_audit_log_query_index_exists(db_session: AsyncSession) -> None:
result = await db_session.execute(
text(
"SELECT indexname FROM pg_indexes "