You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just spent a lot of time debugging a really weird issue and we still haven't quite understood it. However, it occurs only in the combination of
pytest-django
pytest-rerunfailures
pytest-xdist
GitHub actions
Two months ago, a flaky test made it into our codebase. Since then, a good 75% of our GitHub actions runs failed, however only on our test matrix elements that test against PostgreSQL. All of these test failures had dozens, if not hundreds, of error messages like this:
However, in reality, only one test should be failing – and this incorrect test is not even part of the failures listed in the output. Probably because it was retried successfully and therefore not listed as a failure.
All of the listed failures are from the same pytest-xdist worker. It looks like the failing test is somehow leaving the database connection in a broken state, and all tests subsequently run on the same worker are failing.
Now, after days of search, we have found the faulty test and after we fixed it, all of the other failures vanished as well.
We have now put some more research in and discovered: If we roll back our fix and then set --reruns 0 or uninstall pytest-rerunfailures, only the failing test fails, and no other tests, as it should be.
In conclusion, I believe that when pytest-rerunfailures causes a test to be retried, not all necessary setup/teardown logic is called. (This could of course just as well be a bug in pytest-django, I did not figure out a way of determining that.)
Has anyone experienced something similar before?
The text was updated successfully, but these errors were encountered:
We just spent a lot of time debugging a really weird issue and we still haven't quite understood it. However, it occurs only in the combination of
Two months ago, a flaky test made it into our codebase. Since then, a good 75% of our GitHub actions runs failed, however only on our test matrix elements that test against PostgreSQL. All of these test failures had dozens, if not hundreds, of error messages like this:
A sample run with full log can be found e.g. here:
https://github.com/pretix/pretix/actions/runs/11322864056/job/31484383103
Which is a run of the repository at this commit:
https://github.com/pretix/pretix/tree/40c8d014dfba6e97af0ad40d0b7f4abfd087082a
As you can see, the test ends with a summary of
This is the environment running in there:
However, in reality, only one test should be failing – and this incorrect test is not even part of the failures listed in the output. Probably because it was retried successfully and therefore not listed as a failure.
All of the listed failures are from the same
pytest-xdist
worker. It looks like the failing test is somehow leaving the database connection in a broken state, and all tests subsequently run on the same worker are failing.Now, after days of search, we have found the faulty test and after we fixed it, all of the other failures vanished as well.
We have now put some more research in and discovered: If we roll back our fix and then set
--reruns 0
or uninstallpytest-rerunfailures
, only the failing test fails, and no other tests, as it should be.In conclusion, I believe that when
pytest-rerunfailures
causes a test to be retried, not all necessary setup/teardown logic is called. (This could of course just as well be a bug inpytest-django
, I did not figure out a way of determining that.)Has anyone experienced something similar before?
The text was updated successfully, but these errors were encountered: