pytest-randomly
Tests ideally should be independent from each other, making sure to clean up after themselves so they can be run in any order and don't affect one another in any way.
pytest-randomly helps you keep your test suite true to that point, by randomly ordering tests, changing their order every time you run your test suite. This helps detect whether the tests have hidden inter-dependencies that you would not find otherwise.
It shuffles the order of the test items at module level, then at class level, and finally at the order of functions. It also resets random.seed() before each test to a fixed number, which is shown at the beginning of the test section. The random seed can be used at a later time to reproduce the same order with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access