[TIP] Fail-fast testing?

Robert Collins robertc at robertcollins.net
Fri Mar 5 13:43:57 PST 2010

On Fri, 2010-03-05 at 11:40 -0500, J. Cliff Dyer wrote:
> Would it be possible to get something like the fail-fast features that
> have been incorporated into django 1.2 included in unittest somehow?  
> There are two improvements that I think could be generally useful.
> http://code.djangoproject.com/changeset/12034 provides a Ctrl-C override
> (using the signals module), which prevents the test runner from dying
> with an exception on Ctrl-C, and instead finishes the current test, and
> returns the results up to that point.  The output looks like this:
> $ ./manage.py test
> [Snipped test setup]
> .........................^C <Test run halted by Ctrl-C> .
> ----------------------------------------------------------------------
> Ran 26 tests in 1.488s
> OK
> Destroying test database 'default'...
> http://code.djangoproject.com/changeset/11843 provides a --failfast
> option which exits the test run after the first failure, showing all
> test output up to that point.  Both of these are great options to have
> available when working with large test suites.
> I'd be happy to put in some legwork if there were interest in having
> this functionality available in unittest.

I think the ctrl-c handling could be nice; need to be careful though -
some programs test their own ctrl-c handling; don't stomp on them.

Both of these things should be very easy though, as shouldStop is
already part of the result contract.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20100306/bb185817/attachment.pgp>

More information about the testing-in-python mailing list