Repository navigation
test: a child-session test closes its session, and the page driver's owner check counts only its own - #727
Merged
earakely-scale merged 1 commit intoNov 17, 2026
Conversation
…owner check counts only its own The unit tier's event loop is shared across the session. One child-session test left its second session open, so its owner ran for the rest of the worker's run, and the page driver's bounded-call test, which counts every session owner in the loop, failed whenever xdist ran it after that test on the same worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
marked this pull request as ready for review
November 17, 2026 00:38
earakely-scale
deleted the
edgararakelyan/child-session-test-closes-its-session
branch
November 17, 2026 01:25
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
unit (2/2)failed on #725 withtst/unit/drivers/page_driver_test.py::test_a_call_is_bounded_from_when_it_asks_for_its_session_and_leaves_no_session_half_open. The test found one session owner still running, but that owner wasn't one of its own. It was a gateway child session (ChildSessions._own, parked onclose.wait()).The unit tier's event loop is shared across the session (
asyncio_default_test_loop_scope = "session"), and two tests interact through it:child_sessions_test.py::test_a_reported_transport_failure_retires_the_session_once_and_the_next_call_reopensnever closes its second session, unlike every other test in the file. Its owner keeps running for the rest of the worker's run._owntask in the loop. It fails whenever xdist runs it on the same worker after that test.Which tests share a worker depends on how the tier is split, so a PR that adds unrelated tests can surface it. Running the two in that order fails every time on
main.What changes
finally, as the rest of its file does._owners_leftcounts only owners started since its test began, so an owner another test leaves running can't fail it.Tests only.
Testing
tst/unit/env/gatewaythentst/unit/driversin one process, the order that failed: 1275 passed. A hook that reports any session owner left running after each test reported none (before: one, after the child-session test).🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge.Summary
This PR fixes test interference on a shared event loop.
Reviews (1) · Last reviewed commit: "test: a child-session test closes its se..." · Reviewed by Greptile