Skip to content

Avoid duplicate collection errors from workers - #1385

Open
Aurelucien wants to merge 1 commit into
pytest-dev:masterfrom
Aurelucien:fix/deduplicate-collection-errors
Open

Aurelucien wants to merge 1 commit into
pytest-dev:masterfrom
Aurelucien:fix/deduplicate-collection-errors

Conversation

@Aurelucien

@Aurelucien Aurelucien commented Sep 20, 2026

Copy link
Copy Markdown

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 TestGroupScope tests. These five failures also reproduce on unmodified xdist base eba6a447 with the same pytest commit 6a0de9be56365e75ff30d75cee9654739ca95f97 (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.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xdist causes duplicate reports for collector errors

1 participant