Add --reruns-on-exitfirst to override rerun count under -x/--maxfail - #377
LouisDeconinck wants to merge 2 commits into
Conversation
With -x/--exitfirst (or --maxfail), reruns previously still ran to completion before the session could exit on the first failure. The new option sets the rerun count used in that situation, e.g. --reruns-on-exitfirst 0 to fail fast. Closes pytest-dev#249. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
--reruns-on-exitfirst can enable reruns under --pdb without tripping the existing incompatibility check. check_options() only considers --force-reruns / the global rerun setting, while get_reruns_count() now returns this new value whenever maxfail is active. Thus pytest -x --pdb --reruns-on-exitfirst 1 is accepted and will rerun failures even though the plugin otherwise rejects reruns with PDB. Please include the new option in the --pdb validation and add that no-global-reruns case to the tests.
The option enables reruns under -x/--maxfail even without a global rerun count, so it bypassed the existing --pdb incompatibility check. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Fixed in 7da4ffb: |
|
Fixed — |
Summary
--reruns-on-exitfirst N: when-x/--exitfirstor--maxfailis given, the rerun count for every test becomesNinstead of the global/marker setting--reruns-on-exitfirst 0makes-xexit on the first failure immediately, without waiting for reruns--force-rerunsstill wins; negative values are rejected with aUsageErrorCloses #249
Test plan
-x --reruns-on-exitfirst 0disables global and marker reruns-x--maxfailtoo; behavior unchanged without the option; negative value rejected