Repository navigation
test(tiers): check for a leftover probe under the lock (#1758) - #1759
Merged
Merged
Conversation
XdistSubprocessTests.setUp asserted that the probe was absent before it took the exclusive _tier_guard_lock. Under --dist load its two tests, or ProbeWorkerCrashTests, can run on another worker, so a live probe was reported as "already exists -- a previous run did not clean up". - setUp now checks only after the lock is held. The release is still registered first, so a failed check lets go of the lock and LIFO cleanup still unlinks under it. ProbeWorkerCrashTests already checked under the lock and is unchanged. - ProbeLeftoverCheckTests drives that setUp from a thread against a temporary probe directory and lock file, needing neither xdist nor git. It pins that setUp waits out a held lock, and that a real leftover fails, stays on disk, and releases the lock. Closes #1758
Owner
Author
|
Verdict: GOOD TO GO at
|
Contributor
|
Coverage: 89.59% (unit tier, Python 3.15,
Per-file detail: the |
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 #1758.
XdistSubprocessTests.setUpintests/test_tier_guard_xdist.pychecked for a leftover probe file before taking the exclusive_tier_guard_lock. Under--dist load, a worker could see another worker's live probe and fail with "already exists".lock.__enter__(). The lock release is registered before the assert, so a failing check still releases the lock. The unlink is registered after it, so cleanup still unlinks while the lock is held.ProbeWorkerCrashTests(test(tiers): keep the xdist probe out of recursive collection (#1756) #1757) already did this and is unchanged.ProbeLeftoverCheckTestsredirectsTESTS_ROOTand the lock path into a temporary directory, so it needs neither xdist nor git.setUpblocks instead of failing, then that it proceeds once the probe is removed and the lock released. On the old ordering it fails withsetUp did not wait for the lock: [... already exists ...].Tests:
test_unit_tests_queue.pygive 154 passed and 3 skipped (the xdist classes skip in the repo venv).-n 3 --dist loadin an xdist venv, they give 119 passed on each of 5 runs.