-
Notifications
You must be signed in to change notification settings - Fork 0
Add type annotations to all test files and enforce strict mypy #87
Copy link
Copy link
Closed
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedprio:mediumShould do, but not blockingShould do, but not blockingscope:medium1-3 days of work1-3 days of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturespec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:infraCI/CD, tooling, project setupCI/CD, tooling, project setuptype:refactorCode restructuring, cleanupCode restructuring, cleanup
Milestone
Description
Summary
Add return type annotations and full type hints to all test files, then remove the disallow_untyped_defs = false mypy override for tests.* so strict typing is enforced going forward.
Motivation
The pyproject.toml currently relaxes mypy for tests:
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = falseThis lets untyped test functions accumulate silently. As of now there are 219 mypy errors across 24 test files — a manageable amount. If we wait, this number will grow with every new test file, making the eventual cleanup much more painful.
Scope
- Add
-> Nonereturn annotations to all test functions and fixtures - Add parameter type annotations where missing (fixture args, parametrize helpers, etc.)
- Fix any
type-arg,arg-type,attr-defined,no-untyped-callerrors that surface - Remove the
disallow_untyped_defs = falseoverride frompyproject.toml - Verify
uv run mypy src/ tests/passes with zero errors
Current error breakdown
Found 219 errors in 24 files (checked 67 source files)
Common error categories:
no-untyped-def: missing-> Noneon test functionstype-arg: missing generic type parameters (list→list[Any])attr-defined: accessing attributes onBaseExceptioninstead of typed error classesarg-type: dict invariance issues (dict[str, SubClass]vsdict[str, BaseClass])
Acceptance criteria
-
uv run mypy src/ tests/passes with zero errors -
disallow_untyped_defs = falseoverride removed frompyproject.toml - All existing tests still pass
- CI enforces typed tests going forward
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedprio:mediumShould do, but not blockingShould do, but not blockingscope:medium1-3 days of work1-3 days of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturespec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:infraCI/CD, tooling, project setupCI/CD, tooling, project setuptype:refactorCode restructuring, cleanupCode restructuring, cleanup