I created my bunch of Python tests using the Python format unittest.
Now I can run them using
python -m unittest discover -s TestDirectory -p '*.py' -v
I find them all and run them.
Now there is a subtle difference if I run tests on Windows or Linux. Indeed, on Windows, tests are performed in alphabetical order, while on Linux, tests are performed without a visible human-specific detection order, even if they are always the same.
The problem is that I relied on the first two letters of the test file to sort the order in which the tests run. Not that they need to be run in a specific order, but to have some kind of information tests, showing the version data at its output, so that they appear first in the test run log.
Is there something I can do to run tests also in alphabetical order on Linux?
source
share