Skip to content

Migrate tests from aioresponses to aiointercept - #480

Merged
joostlek merged 2 commits into
mainfrom
claude/brave-fermi-lxt93m
Sep 19, 2026
Merged

joostlek merged 2 commits into
mainfrom
claude/brave-fermi-lxt93m

Conversation

@joostlek

Copy link
Copy Markdown
Owner

Proposed Changes

Migrate the test suite from aioresponses to aiointercept.

aioresponses builds aiohttp.ClientResponse objects by hand, which breaks on aiohttp 3.14 (it added a required stream_writer keyword argument), failing with:

TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer'

aiointercept routes requests through a real aiohttp.web test server instead, so it is immune to this and supports aiohttp >= 3.13, while keeping a largely aioresponses-compatible API.

Changes:

  • pyproject.toml: replace the aioresponses dev dependency with aiointercept (0.1.10); poetry.lock regenerated (only that swap, no unrelated bumps).
  • tests/conftest.py: the responses fixture becomes async and uses aiointercept(mock_external_urls=True) so the client's hardcoded absolute URLs are intercepted via DNS patching.
  • Test host is now a hostname (overseerr.test) instead of an IP address. aiohttp short-circuits bare IP literals before ever calling the resolver, so DNS-based interception cannot see them — a hostname is required for aiointercept to intercept the requests. This is a test-only change; no client behaviour is affected.
  • tests/test_overseerr.py: swap imports and type annotations to aiointercept. The encoded-spaces search test now registers the URL the client actually sends on the wire (the keyword is quote()-encoded and then encoded again by aiohttp, so the space arrives double-encoded as %2520); aiointercept matches the real wire bytes rather than aioresponses' more lenient normalisation. No assertions were weakened, skipped, or xfailed.

Validated with ruff, mypy, and pytest (54 passed). Also verified green with aiohttp==3.14.3 installed.

Related Issues

This unblocks the aiohttp 3.14 renovate upgrade: #429

🤖 Generated with Claude Code

https://claude.ai/code/session_011Duv5DUNhos1yhCzhxGzvi


Generated by Claude Code

aioresponses builds aiohttp.ClientResponse objects by hand and is
incompatible with aiohttp 3.14, which added a required stream_writer
keyword argument. Replace it with aiointercept, which routes requests
through a real aiohttp test server and supports aiohttp >= 3.13.

The responses fixture becomes async and enables mock_external_urls so
the hardcoded absolute URLs are intercepted via DNS patching. Because
DNS patching cannot intercept bare IP literals, the test mock host is
changed from an IP address to a hostname.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Duv5DUNhos1yhCzhxGzvi
@joostlek joostlek added the enhancement Enhancement of the code, not introducing new features. label Sep 19, 2026
@joostlek
joostlek merged commit a934b14 into main Sep 19, 2026
12 checks passed
@joostlek
joostlek deleted the claude/brave-fermi-lxt93m branch September 19, 2026 13:47
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Enhancement of the code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants