Skip to content

Enforce typed defs in httpx2 tests#987

Merged
Kludex merged 3 commits into
mainfrom
type-annotate-httpx2-tests
May 24, 2026
Merged

Enforce typed defs in httpx2 tests#987
Kludex merged 3 commits into
mainfrom
type-annotate-httpx2-tests

Conversation

@Kludex
Copy link
Copy Markdown
Member

@Kludex Kludex commented May 24, 2026

Removes the last disallow_untyped_defs = false mypy override (tests.httpx2.*), so the entire test suite is now held to strict typing alongside the source. Annotates the 535 functions this flagged: ~388 just needed -> None, ~147 needed parameter types (fixtures, ASGI/WSGI scope/receive/send handlers, parametrized values, event-hook dicts).

The transport subclasses in the context-manager tests gained an explicit return self in __enter__/__aenter__ to satisfy the base -> Self contract; behavior is unchanged (the tests don't bind the as target).

mypy, ruff check/format, the unasync --check, and the affected test files all pass.

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Remove the last `disallow_untyped_defs = false` mypy override (`tests.httpx2.*`) so the whole test suite is held to strict typing, and annotate the flagged functions with parameter and return types.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 24, 2026

Merging this PR will not alter performance

✅ 15 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing type-annotate-httpx2-tests (2078c34) with main (e506309)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Kludex added 2 commits May 24, 2026 14:31
The coverage `exclude_also` from #988 now excludes `if TYPE_CHECKING:` blocks globally, so the per-block `# pragma: no cover` is no longer needed.
@Kludex Kludex merged commit c2a2b8d into main May 24, 2026
13 checks passed
@Kludex Kludex deleted the type-annotate-httpx2-tests branch May 24, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant