Migrate tests from aioresponses to aiointercept - #480
Merged
Merged
Conversation
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
…t93m # Conflicts: # poetry.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Migrate the test suite from
aioresponsestoaiointercept.aioresponsesbuildsaiohttp.ClientResponseobjects by hand, which breaks on aiohttp 3.14 (it added a requiredstream_writerkeyword argument), failing with:aiointerceptroutes requests through a realaiohttp.webtest server instead, so it is immune to this and supports aiohttp >= 3.13, while keeping a largelyaioresponses-compatible API.Changes:
pyproject.toml: replace theaioresponsesdev dependency withaiointercept(0.1.10);poetry.lockregenerated (only that swap, no unrelated bumps).tests/conftest.py: theresponsesfixture becomesasyncand usesaiointercept(mock_external_urls=True)so the client's hardcoded absolute URLs are intercepted via DNS patching.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 foraiointerceptto intercept the requests. This is a test-only change; no client behaviour is affected.tests/test_overseerr.py: swap imports and type annotations toaiointercept. The encoded-spaces search test now registers the URL the client actually sends on the wire (the keyword isquote()-encoded and then encoded again by aiohttp, so the space arrives double-encoded as%2520);aiointerceptmatches the real wire bytes rather thanaioresponses' more lenient normalisation. No assertions were weakened, skipped, or xfailed.Validated with
ruff,mypy, andpytest(54 passed). Also verified green withaiohttp==3.14.3installed.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