pytest-dev / pytest-xdist

pytest plugin for distributed testing and loop-on-failures testing modes.
https://pytest-xdist.readthedocs.io
MIT License
1.46k stars 232 forks source link

Use a different exit code when collection fails #1122

Open Redoubts opened 1 month ago

Redoubts commented 1 month ago

I noticed https://pytest-xdist.readthedocs.io/en/stable/known-limitations.html#order-and-amount-of-test-must-be-consistent

And indeed I expect pytest to fail if I have some randomness in my test definitions (say a random parameterized fixture).

Different tests were collected between gw1 and gw2. The difference is:
...

But I noticed that pytest exits with code 1 in this case. This code is reserved for "collected but failed" https://docs.pytest.org/en/stable/reference/exit-codes.html. I think this should be either code 3 or 5, but at least not code 1 since this feels like a collection or otherwise "internal" error.