Skip to content

Preserve duplicate collected items in grouped scheduling - #1383

Open
AdemVessell wants to merge 1 commit into
pytest-dev:masterfrom
AdemVessell:fix/grouped-collection-occurrences
Open

AdemVessell wants to merge 1 commit into
pytest-dev:masterfrom
AdemVessell:fix/grouped-collection-occurrences

Conversation

@AdemVessell

@AdemVessell AdemVessell commented Sep 14, 2026 •

Copy link
Copy Markdown

Preserve duplicate collected items in grouped scheduling

With --keep-duplicates, pytest can collect the same test path more than once.
loadscope, loadfile, and loadgroup previously keyed their internal work
units by nodeid, so duplicate occurrences collapsed to one item. Dispatch also
recovered positions with repeated list.index() searches.

This current-main-based update keeps each collection index through grouping,
dispatch, completion, and worker replacement, while retaining nodeids for
grouping and crash-report text. The worker protocol and public scheduler hook
signatures are unchanged.

Added regression coverage verifies both ordinary completion and unfinished-work
redistribution after a worker restart, plus subprocess coverage that runs two
explicit duplicate occurrences through all three grouped schedulers.

Local current-base verification on macOS ARM64: Python 3.12.13 / pytest 9.1.1 /
execnet 2.1.2. Relevant suite: 66 passed and 2 expected xfails, including all
9 new regression cases. Ruff, mypy, and git diff --check passed. The
unmodified current master reproduced one pass for each grouped scheduler; the
repaired tree reproduced two passes. Windows and current pytest-main remain
unverified for this update; earlier CI applies only to earlier revisions. No
claim of maintainer acceptance, full matrix coverage, or benchmark speedup is
made here.

Prepared with AI assistance; no independent human review is claimed.

@AdemVessell
AdemVessell force-pushed the fix/grouped-collection-occurrences branch from 385531b to c2db44e Compare December 3, 2026 01:47

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.

1 participant