[TIP] [nose] any way to just run tests that failed in the previous run?
holger krekel
holger at merlinux.eu
Thu Jun 21 03:10:03 PDT 2012
On Thu, Jun 21, 2012 at 11:00 +0100, Chris Withers wrote:
> Is there a plugin or some option I'm missing that would let me say
> "please just run the tests that failed in the last run?"
>
> The use case I have is making changes to a suite containing around
> 3300 tests, which takes around 20 mins to run completely. For
> obvious reasons, I don't want to run all the tests all the time, but
> if I make a systematic change, I do want to make sure they all pass.
>
> The workflow I'd like to use is:
>
> - make change that will affect quite a few tests
> - run all tests to see what breaks
> - fix breakages
> - run only tests that failed
> - rinse and repeat
> - do one final run of all tests to be safe
>
> Anyone know of anything that'd help?
Not sure that helps, but if you install "pip install pytest-cache"
and run "py.test --lf" and your tests are compatible enough for pytest's
current nose-compat support, you get what you need. See
http://packages.python.org/pytest-cache/readme.html#the-new-lf-rerun-last-failing-option
The --lf option is also careful enough to allow "py.test --lf SOMEFILE"
or "py.test --lf --maxfailed=2" to work -- it will not forget about the
previous other failures, so you can tackle failures two-by-two (or whatever).
best,
holger
More information about the testing-in-python
mailing list