Skip to content

Shuffle before other plugins' collection hooks - #746

Merged
adamchainz merged 1 commit into
mainfrom
tryfirst
Sep 1, 2026
Merged

Shuffle before other plugins' collection hooks#746
adamchainz merged 1 commit into
mainfrom
tryfirst

Conversation

@adamchainz

Copy link
Copy Markdown
Member

Fixes #701.

Make pytest-randomly run first, even before other plugin’s collection hooks marked "tryfirst", by turning the hook into a hook wrapper.

This ensures that pytest-django, and other plugins that group tests with a stable sort, apply their grouping on top of the shuffled order, making the final order reproducible from the seed.

Now we require pytest 8 and pluggy 1.0, the first version to support hook wrappers.

Fixes #701.

Make pytest-randomly run first, even before other plugin’s collection hooks marked "tryfirst", by turning the hook into a hook wrapper.

This ensures that pytest-django, and other plugins that group tests with a stable sort, apply their grouping on top of the shuffled order, making the final order reproducible from the seed.

Now we require pytest 8 and pluggy 1.0, the first version to support hook wrappers.
@adamchainz adamchainz mentioned this pull request Sep 1, 2026
@adamchainz
adamchainz merged commit 0d00951 into main Sep 1, 2026
9 checks passed
@adamchainz
adamchainz deleted the tryfirst branch September 1, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different test order

1 participant