Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pytest show order of random order tests

Tags:

pytest

Is it possible to somehow see list of tests in the order in which they were performed using pytest --random-order flag? In random-order package documentation (https://pypi.org/project/pytest-random-order/) I found only that it reports seed so you can re-run tests in same order, but I need to see which test run before each other to find out some dependency (my tests are green in normal order, but red in some runs of random order) Thanks in advance.

like image 877
Filip Jašek Avatar asked Oct 21 '25 14:10

Filip Jašek


1 Answers

I got an idea to look on this problem from pytest perspective not just random-order plugin and I find that all I needed to do is add flag -rA where A stands for All test passed, skipped and failed. (See Pytest docs or Stack Overflow answers here) So to run test in random order and with summary (list) of tests at the end of the run use:

pytest -rA --random-order
like image 147
Filip Jašek Avatar answered Oct 23 '25 07:10

Filip Jašek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!