[TIP] RFC: Add TestResult.done()

Robert Collins robertc at robertcollins.net
Wed Apr 8 06:07:28 PDT 2009


JML's testtools has a TestResult subclass with a done() method. The
reason for this method is to allow doing things after the last test has
run. While a result can infer 'first test' it can't infer 'last test'
without ugliness like __del__.

Some uses for this are:
 - reporting summary data
 - closing external resources like log files, sockets to remote machines
etc
 - <your idea here>

This can be added quite safely I think - check for the attribute, and if
present call it.

done() could be spelt differently - I don't think anyone would care.
testsFinished()
finished()
etc.

I was prompted to send this mail, as I just needed to run some code in a
TestResult after all the tests in a different project, and remembered
its not part of the stdlib yet :)

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090408/a697003e/attachment.pgp 


More information about the testing-in-python mailing list