Skip to content

[PR #12603/dbe83fd0 backport][3.13] Fix flaky test_handler_returns_not_response on PyPy via debug-mode fixture#12607

Merged
bdraco merged 1 commit into
aio-libs:3.13from
bdraco:patchback/backports/3.13/dbe83fd0776fd91b94543c354f5b8172b49a1d15/pr-12603
May 18, 2026
Merged

[PR #12603/dbe83fd0 backport][3.13] Fix flaky test_handler_returns_not_response on PyPy via debug-mode fixture#12607
bdraco merged 1 commit into
aio-libs:3.13from
bdraco:patchback/backports/3.13/dbe83fd0776fd91b94543c354f5b8172b49a1d15/pr-12603

Conversation

@bdraco

@bdraco bdraco commented May 18, 2026

Copy link
Copy Markdown
Member

This is a backport of PR #12603 as merged into master (dbe83fd).

What do these changes do?

Route loop.set_debug(True) through a new loop_debug_mode
fixture in tests/conftest.py so the two failing tests in
tests/test_web_functional.py turn debug off before the
aiohttp_client fixture finalizes. The fixture is requested as
the last test parameter so pytest tears it down before
aiohttp_client.

Leaving debug on through teardown let PyPy 3.11's asyncio
slow-callback logger walk into Task.__repr__ during connector
close, surfacing a spurious RuntimeWarning: coroutine was never awaited that filterwarnings = error promotes to a teardown
failure. CPython's reprlib.recursive_repr keeps the same walk
bounded so the flake only manifested on the PyPy CI leg, as seen
on https://github.com/aio-libs/aiohttp/actions/runs/26003637612/job/76431289229.

Are there changes in behavior for the user?

No. Tests-only.

Is it a substantial burden for the maintainers to support this?

No.

Related issue number

None.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist (the changes are themselves to tests)
  • Documentation reflects the changes N/A
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder
Agent run details (optional, for reviewers)

Verified the fixture teardown order with an instrumented probe: the
aiohttp_client teardown runs after loop_debug_mode has set
debug back to False when loop_debug_mode is the last test
parameter. Ran the two affected tests against the default C build
and AIOHTTP_NO_EXTENSIONS=1 on CPython 3.14; both pass. The
PyPy 3.11 leg cannot be reproduced locally and will be verified by
CI on this PR.

make doc-spelling passes on the new fragment (pre-existing
flakey / accessor warnings in older fragments are
unaffected).

Drafted with Claude Code (claude-opus-4-7); reviewed by @bdraco.

@bdraco bdraco requested review from asvetlov and webknjaz as code owners May 18, 2026 00:37
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label May 18, 2026
Comment thread tests/conftest.py
Comment thread tests/conftest.py
@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (5cf0c70) to head (30b77f4).
⚠️ Report is 1 commits behind head on 3.13.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             3.13   #12607      +/-   ##
==========================================
- Coverage   98.29%   98.29%   -0.01%     
==========================================
  Files         128      128              
  Lines       44842    44847       +5     
  Branches     2437     2437              
==========================================
+ Hits        44078    44082       +4     
  Misses        589      589              
- Partials      175      176       +1     
Flag Coverage Δ
CI-GHA 98.17% <100.00%> (-0.01%) ⬇️
OS-Linux 97.93% <100.00%> (-0.01%) ⬇️
OS-Windows 95.62% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.19% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 96.73% <100.00%> (+<0.01%) ⬆️
Py-3.10.20 97.21% <100.00%> (+<0.01%) ⬆️
Py-3.11.15 97.40% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 96.92% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 97.00% <100.00%> (+<0.01%) ⬆️
Py-3.12.13 97.49% <100.00%> (+<0.01%) ⬆️
Py-3.13.13 97.71% <100.00%> (-0.02%) ⬇️
Py-3.14.4 96.90% <100.00%> (+<0.01%) ⬆️
Py-3.14.5 97.40% <100.00%> (+<0.01%) ⬆️
Py-3.14.5t 96.73% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 96.61% <100.00%> (+<0.01%) ⬆️
Py-3.9.25 97.09% <100.00%> (-0.01%) ⬇️
Py-pypy3.11.15-7.3.22 96.79% <100.00%> (-0.01%) ⬇️
VM-macos 97.19% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 97.93% <100.00%> (-0.01%) ⬇️
VM-windows 95.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented May 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 59 untouched benchmarks


Comparing bdraco:patchback/backports/3.13/dbe83fd0776fd91b94543c354f5b8172b49a1d15/pr-12603 (30b77f4) with 3.13 (5cf0c70)

Open in CodSpeed

@bdraco bdraco merged commit f57a6ab into aio-libs:3.13 May 18, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant