pytest-randomly icon indicating copy to clipboard operation
pytest-randomly copied to clipboard

Shuffle inside modules only mode

Open alisazosimova opened this issue 3 years ago • 1 comments

Description

We're trying to transition to randomised tests, and this is a feature that I feel strongly about as a helpful one in the period of transition when you expect lots of failures. This is our project dirs:

/root
- tests/
- - new_app_tests/
- - old_app_tests/
- - unit_tests/

When I run the tests, they're shuffled within the tests/ folder:

tests/new_app_tests/some_tests3.py . . . . . . . . .
tests/old_app_tests/ some_tests4.py. . . . . . .
tests/unit_tests/some_tests22.py . . . . . . . . .
tests/new_app_tests/some_tests10.py . . . . . . . . .

While it would be more convenient for the transition period to have tests shuffled within subdirectories of tests/, like this:

tests/new_app_tests/some_tests3.py . . . . . . . . .
tests/new_app_tests/some_tests2.py . . . . . . . . .
tests/new_app_tests/some_tests1.py . . . . 
tests/new_app_tests/some_tests0.py . . . . . . . . .
tests/old_app_tests/ some_tests4.py. . . . . . .
tests/old_app_tests/ some_tests3.py. . . . . . .
tests/old_app_tests/ some_tests1.py. . . . . . .
tests/old_app_tests/ some_tests2.py. . . . . . .
tests/unit_tests/some_tests2.py . . . . . . . . . . . . . . . . 

Does this make sense?

alisazosimova avatar Jul 14 '22 12:07 alisazosimova

What motivates this? Are you seeing a lot of test failures due to shuffling? Did you try the --randomly-dont-reorganize flag, which disables all re-ordering? Perhaps you could install with that flag, then remove it in a branch and rerun tests many times to find and fix your ordering-related problems.

adamchainz avatar Jul 20 '22 16:07 adamchainz

Closing due to no reply

adamchainz avatar Oct 10 '22 22:10 adamchainz