-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to retry N times until test passes #11508
Comments
The pytest-repeat plugin does exactly this. |
@The-Compiler No it does different thing or even contrary to my request. Can you reconsider? 🙏 pytest-repeat repeats fixed number of times or if combined with I requested to repeat until success. For example if test is succeeded on the first run it should not be repeated. Repeating after success increases probability of test failure and this is contrary to the goal that I described. Goal of my request is to decrease probability of (intermittent) test failure by repeating after failure. |
Whoops, my bad - I was thinking of pytest-rerunfailures, not pytest-repeat. Sorry! |
Thanks much! (I already managed to fill feature request on pytest-repeat.) |
What's the problem this feature will solve?
Some tests are intermittently fail, For example distribution could run tests for multiple packages on quite loaded server (because things are parallelized)) and in that case race conditions occur. Or test could be coded unreliably. There could be slow virtual machine that cause timeouts. These factors could change environment to be sometimes different from when upstream run tests manually on their desktop. If manual run fails upstream developer could just rerun it again. But when we run multiple tests in automated way this could break workflows, send alerts, etc. making life of package maintainers harder.
Describe the solution you'd like
ctest
have option like thisThis could be good for pytest to support something similar to help with 'probabilistic' tests.
Fixing test could be very time consuming task, end especially for subtle race conditions. In that case package maintainers tend to disable tests sometimes skipping whole test run. Of course this is wrong strategy but this happens.
As alternative to this maintainer could run pytest with something like
--repeat-until-pass 3
greatly lowering probability of false positive test failures.Alternative Solutions
Alternative solutions are: to fix test (hard and human time consuming); to not run particular test (sometimes this covers almost all tests); to not run test suite at all (stains karma); to repeat whole test run (could take very long time when there are a lot of tests).
The text was updated successfully, but these errors were encountered: