Repository navigation
Conversation
Member
|
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest-xdist maintainers; I prompted it, it did the work, I read it. I reproduced this on master. Serial pytest stops with "Interrupted: 1 error during collection" (exit 2), while Before this leaves draft:
Generated by Claude Code |
Honor pytest's collection error option before scheduling tests. Refs pytest-dev#1087
AyaanshC
force-pushed
the
codex/stop-on-collection-errors
branch
from
November 28, 2026 07:02
4c65361 to
aa9c7b5
Compare
AyaanshC
marked this pull request as ready for review
November 28, 2026 07:05
This branch has not been deployed
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.
Proposed change
Refs #1087. With one module that raises during collection and another that collects successfully, serial pytest stops with exit code 2 by default. xdist currently runs the collected test and exits with code 1. I reproduced this with and without
--lf --last-failed-no-failures none.This draft proposes making the distributed default match serial pytest. The controller stops before scheduling tests if a worker reported a collection failure.
--continue-on-collection-errorsretains the current behavior for users who want to run the successfully collected tests.I'd appreciate feedback on changing the default and exit status in xdist before moving this out of draft.
Verification
Review follow-up
Rebased onto master with #1408. The stop reason now matches serial pytest for one or several distinct collection errors, even if two workers report the same traceback. The removal changelog entry explains exit code 2 and the option to restore the previous behavior.
The updated collection and worker-usage regression selection passed with pytest 7.0.0 and 9.2.0 (13 tests on each). The full Linux suite on pytest 9.2.0 returned 264 passed, 6 skipped, and 10 expected failures.
AI assistance
OpenAI Codex assisted with investigation, the code and tests, and the PR description. AyaanshC reviewed the original patch. Codex prepared the follow-up described above.