Repository navigation
Migrate tests from aioresponses to aiointercept - #834
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. - Swap the dev dependency aioresponses -> aiointercept in pyproject.toml and regenerate the lock. - Make the responses fixture async, using aiointercept(mock_external_urls=True) so hardcoded absolute URLs are intercepted via DNS patching. - Update imports and type annotations in the test module. - Make assert_called_once_with params string-valued and drop now-unused type: ignore[no-untyped-call] comments (aiointercept's assertions are typed). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01CNRWkAcanduH67dxfeMJgq
|
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
aioresponsesbuildsaiohttp.ClientResponseobjects by hand, which breaks on aiohttp 3.14 (it added a requiredstream_writerkeyword argument), failing with:This replaces
aioresponseswithaiointercept, which routes requests through a real aiohttp test server (immune to the internalClientResponsesignature) and supportsaiohttp >= 3.13, while keeping a largely aioresponses-compatible API.Changes:
aioresponses = "0.7.9"→aiointercept = "0.1.10"inpyproject.tomland regeneratepoetry.lock(minimal diff: only that package changes).responsesfixture intests/conftest.pyasync, usingaiointercept(mock_external_urls=True)— required so the client's hardcoded absolute Spotify URLs are intercepted via DNS patching.responses: aiointerceptannotations intests/test_spotify.py.assert_called_once_withparamsvalues string-valued (aiointercept typesparamsasMapping[str, str]; the query-string semantics are unchanged) and drop now-unused# type: ignore[no-untyped-call]comments, since aiointercept's assertions are typed.Validation (
poetry runwith Python 3.13):ruff check,mypy tests/ src/, andpytest(106 passed) all green. Also verified green withaiohttp==3.14.3installed, proving the unblock.The final aiohttp version in
poetry.lockstays3.13.5(the dev pinaiohttp = "<3.14"is left untouched — that line belongs to the renovate PR below).Related Issues
Unblocks the aiohttp 3.14 renovate upgrade: #792
🤖 Generated with Claude Code
https://claude.ai/code/session_01CNRWkAcanduH67dxfeMJgq
Generated by Claude Code