You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for Incremental tests by selectively disabling shuffling #319
I'd be open to adding markers like pytest-random-order. It would also help with rollout of pytest-randomly on a large codebase, one can mark off the "unsafe to shuffle" modules/classes without needing to fix all their interdependencies immediately.
I saw that there is a CLI option to disable shuffling on a session scope when I looked at the code.
For module and class scope it might be possible to just check for a custom mark, e.g. 'no-shuffle-mark' in item.keywords, and disable the shuffling of test items before adding them to the collection. That should be 2-4 locations in the code (just before the random.shuffle call).
When annotating a module (pytestmark), the marker should be recorded in a class and function items if I remember correctly, so the checks can be the same.
The only issue might be marked functions (which makes no sense but could disable shuffling unintentionally for a larger scope depending on how checks are implemented).
Activity
adamchainz commentedon Jan 17, 2021
I'd be open to adding markers like
pytest-random-order. It would also help with rollout of pytest-randomly on a large codebase, one can mark off the "unsafe to shuffle" modules/classes without needing to fix all their interdependencies immediately.Querela commentedon Jan 17, 2021
I saw that there is a CLI option to disable shuffling on a session scope when I looked at the code.
For module and class scope it might be possible to just check for a custom mark, e.g.
'no-shuffle-mark' in item.keywords, and disable the shuffling of test items before adding them to the collection. That should be 2-4 locations in the code (just before therandom.shufflecall).When annotating a module (
pytestmark), the marker should be recorded in a class and function items if I remember correctly, so the checks can be the same.The only issue might be marked functions (which makes no sense but could disable shuffling unintentionally for a larger scope depending on how checks are implemented).
Something along:
Maybe
item.iter_markers(name="...")if"..." in item.keywordsdoes not work?