Avoid duplicate collection errors from workers - #1385
Open
Aurelucien wants to merge 1 commit into
Open
Aurelucien wants to merge 1 commit into
Aurelucien wants to merge 1 commit into
Conversation
Fixes pytest-dev#1140. Compare the node ID and rendered error so independently reconstructed reports are deduplicated without hiding distinct failures. Co-authored-by: OpenAI Codex <noreply@openai.com>
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.
Fixes #1140.
With two workers, a single module-level exception is currently reported twice in the terminal and as two errors in JUnit XML. The controller compares exception representation objects, which do not compare equal after being reconstructed for separate workers.
Deduplicate using the node ID and rendered error instead. The regression runs real workers and checks terminal outcomes and JUnit output: identical failures are reported once, while different failures in the same module and failures from different modules remain separate.
Validation:
Python 3.12 / pytest 9.1.1: full suite, 225 passed, 6 skipped, 10 xfailed.
Python 3.9 / pytest 7.0.0: five targeted regression tests passed.
All pre-commit hooks passed, including mypy.
CI: 22 checks passed; the Linux and Windows pytest-main jobs each fail the same five pre-existing
TestGroupScopetests. These five failures also reproduce on unmodified xdist baseeba6a447with the same pytest commit6a0de9be56365e75ff30d75cee9654739ca95f97(local Python 3.11.15/macOS). Stable pytest matrices pass; no unrelated compatibility changes are included.Regression tests included.
Towncrier entry:
changelog/1140.bugfix.rst.Implemented and tested with OpenAI Codex assistance.