Repository navigation
test(tiers): keep the xdist probe out of recursive collection (#1756) - #1757
Merged
Merged
Conversation
A worker that dies mid-way through XdistSubprocessTests never runs its cleanup, so tests/protocols/test_zzz_xdist_guard_probe_unit.py stays on disk. xdist starts a replacement worker, which collects tests/ afresh; its pytest_collection_modifyitems audit finds the probe, sets session.shouldfail, and the controller ends the session with xdist.dsession.Interrupted, exit 2 (GraalPy job 116215824320, gw10). - tests/conftest.py: collect_ignore the probe's reserved path. pytest checks collect_ignore only while recursing, never for an initial path, so the probe's own nested run, which names it explicitly, still collects and audits it. SuiteIsCleanTests still scans it. - tests/test_tier_guard_xdist.py: ProbeWorkerCrashTests runs the real probe test under -n 2 with a -p plugin that kills the worker after the probe is written. It holds the exclusive lock throughout, then removes the stale probe. Skips without xdist, like its neighbours. Fails on main (Interrupted, exit 2), passes here; tier-guard, queue and docs-claims tests pass in the repo venv and under -n 2. Closes #1756
Owner
Author
|
Verdict: GOOD TO GO at
|
Contributor
|
Coverage: 89.59% (unit tier, Python 3.15,
Per-file detail: the |
3 of 13 tasks
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Narrow runs only, listed below.Added a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription
Closes #1756.
On #1755's GraalPy run, a crashed worker turned the whole session into pytest exit 2. The mechanism is now measured, and it corrects the issue's guess:
XdistSubprocessTests.setUpwrites the probetests/protocols/test_zzz_xdist_guard_probe_unit.pyand removes it only throughaddCleanup.tests/again, and the collection-time audit intests/conftest.pyfound the probe's read and setsession.shouldfail.Interruptedonce the other workers drained.Fix:
tests/conftest.pyaddscollect_ignore = [f'protocols/{PROBE_MODULE_NAME}']. pytest consultscollect_ignoreonly while it recurses into a directory, never for a path named on the command line. So:SuiteIsCleanTestsstill scans the path on disk.Test:
ProbeWorkerCrashTests, intests/test_tier_guard_xdist.py.pytest -n 2session, where the worker callsos._exitonce the probe is on disk.Interruptedand the exit is 1.conftest.pyit fails, with the CI-identical message. Without xdist it skips, like its neighbours.Tests: the two tier-guard modules plus
test_unit_tests_queue.pygive 152 passed, 3 skipped (the xdist classes skip in the repo venv). In an xdist venv, both tier-guard modules under-n 2give 117 passed.