[PR #12603/dbe83fd0 backport][3.14] Fix flaky test_handler_returns_not_response on PyPy via debug-mode fixture#12608
Conversation
…xture (aio-libs#12603) (cherry picked from commit dbe83fd)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.14 #12608 +/- ##
=======================================
Coverage 98.20% 98.20%
=======================================
Files 135 135
Lines 47245 47250 +5
Branches 2536 2536
=======================================
+ Hits 46397 46403 +6
Misses 671 671
+ Partials 177 176 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Merging this PR will not alter performance
Comparing Footnotes
|
This is a backport of PR #12603 as merged into master (dbe83fd).
What do these changes do?
Route
loop.set_debug(True)through a newloop_debug_modefixture in
tests/conftest.pyso the two failing tests intests/test_web_functional.pyturn debug off before theaiohttp_clientfixture finalizes. The fixture is requested asthe 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 connectorclose, surfacing a spurious
RuntimeWarning: coroutine was never awaitedthatfilterwarnings = errorpromotes to a teardownfailure. CPython's
reprlib.recursive_reprkeeps the same walkbounded 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
CONTRIBUTORS.txtCHANGES/folderAgent run details (optional, for reviewers)
Verified the fixture teardown order with an instrumented probe: the
aiohttp_clientteardown runs afterloop_debug_modehas setdebug back to
Falsewhenloop_debug_modeis the last testparameter. Ran the two affected tests against the default C build
and
AIOHTTP_NO_EXTENSIONS=1on CPython 3.14; both pass. ThePyPy 3.11 leg cannot be reproduced locally and will be verified by
CI on this PR.
make doc-spellingpasses on the new fragment (pre-existingflakey/accessorwarnings in older fragments areunaffected).
Drafted with Claude Code (claude-opus-4-7); reviewed by @bdraco.