pytest-repeat icon indicating copy to clipboard operation
pytest-repeat copied to clipboard

Skip remaining repeated tests on failure

Open dirk-thomas opened this issue 6 years ago • 2 comments

The rerunfailures plugin can be used to detect flaky tests and ignore them by trying to rerun previous failed tests. If a repeated run succeeds that is then considered "good enough".

I am interested in the "opposite" feature and thought it might fit into this plugin. To ensure that a test is not flaky I want to run it multiple times. This plugin already supports that use case. In the case where a test fails I don't want the remaining invocations to happen (in order to save time). Using the pytest option -x is not feasible for that case since I am still interested in the result of all different tests and don't want to abort testing all together.

Would an additional option like --stop-repeating-same-test-if-it-failed-once (just a name to describe the semantic) fit into this plugin? If yes, with a little pointer I might be able to provide a pull request if that is helpful.

dirk-thomas avatar Jun 05 '18 16:06 dirk-thomas

Is there any update on this? Would also be very interested in such a feature!

AdamWRichardson avatar Nov 26 '21 11:11 AdamWRichardson

I am also interested in this, except I want to set a limit to how many times an individual test can fail before it stops running this test and continues with the rest. Pytest has the --maxfail attribute, but I would like to combine it with python-repeat, therefore needing it on an individual test. I'm looking for something like @pytest.mark.repeat(100) @pytest.mark.maxfail(10) def test(): Any updates?

Martiix avatar Mar 07 '22 06:03 Martiix