Skip to content

Migrate tests from aioresponses to aiointercept - #834

Merged
joostlek merged 1 commit into
mainfrom
claude/fervent-hawking-b1ha5o
Sep 19, 2026
Merged

joostlek merged 1 commit into
mainfrom
claude/fervent-hawking-b1ha5o

Conversation

@joostlek

Copy link
Copy Markdown
Owner

Proposed Changes

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'

This replaces aioresponses with aiointercept, which routes requests through a real aiohttp test server (immune to the internal ClientResponse signature) and supports aiohttp >= 3.13, while keeping a largely aioresponses-compatible API.

Changes:

  • Swap the dev dependency aioresponses = "0.7.9" → aiointercept = "0.1.10" in pyproject.toml and regenerate poetry.lock (minimal diff: only that package changes).
  • Make the responses fixture in tests/conftest.py async, using aiointercept(mock_external_urls=True) — required so the client's hardcoded absolute Spotify URLs are intercepted via DNS patching.
  • Update imports and responses: aiointercept annotations in tests/test_spotify.py.
  • Make assert_called_once_with params values string-valued (aiointercept types params as Mapping[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 run with Python 3.13): ruff check, mypy tests/ src/, and pytest (106 passed) all green. Also verified green with aiohttp==3.14.3 installed, proving the unblock.

The final aiohttp version in poetry.lock stays 3.13.5 (the dev pin aiohttp = "<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

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
@joostlek joostlek added the enhancement Enhancement of the code, not introducing new features. label Sep 19, 2026 — with Claude
@sonarqubecloud

Copy link
Copy Markdown

@joostlek
joostlek merged commit cd473dc into main Sep 19, 2026
13 of 14 checks passed
@joostlek
joostlek deleted the claude/fervent-hawking-b1ha5o branch September 19, 2026 13:20
@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