EDIT June 2021: Surprised this is still getting votes. If at all possible, consider using ptyest with the --last-failed
option.
It turns out this is trivial with nose. First run the command and include the --with-id
flag.
# Environment stuff deleted
nosetests python/*Tests.py -v --with-id
nosetests python/*Tests.py -v --failed
If, say, four tests fail, running with the --failed
flag will run only those four tests. If you then correct three, running with --failed
will run only the remaining failed test.
Running --with-id
again resets the tracking of failed tests and runs all the found tests.
I searched quite a bit for this before I wandered into writing my own plugin. When I was researching how to register my plug-in I found some code that happened to be the testid plugin provided by nose, which provides the functionality above. Sheesh. I am documenting this here, hoping to save someone else some time.
Of course, now that I know about it, it’s so obviously found with:
nosetests --help
I scanned the docs initially, but didn’t think it would be so easy, so I did so half-heartedly.