Re:Stop requiring only one assertion per unit test: Multiple...
by masklinn on Saturday November 05, 2022 @08:59AM
(#33480982)
> With pytest you can use the -x flag to stop after the first test failure.
> Even better you can use that in combination with -lf to only run the last failed test.
Fwiw `--sw` is much better for that specific use-case.
`--lf` is more useful to run the entire test suite, then re-run just the failed tests (of the entire suite). IIRC it can have some odd interactions with `-x` or `--maxfail`, because the strange things happen to the cached "selected set".
Though it may also be because I use xdist a fair bit, and the interaction of xdist with early interruptions (x, maxfail, ...) seems less than perfect.
With pytest you can use the -x flag to stop after the first test failure.
Even better you can use that in combination with -lf to only run the last failed test.