Any way to determine test success from inside tearDown()?
Christopher Corbell
chriscorbell at gmail.com
Mon Mar 5 16:04:54 EST 2007
This question pertains to PyUnit, esp. unittest.TestCase subclasses.
Does anyone know of a way from within the TestCase tearDown() method
to determine whether the current test succeeded or not?
What I'm after is a specialized clean-up approach for error/failure
cases.
This is somewhat related to some earlier threads in this group about
using fixtures across test invocations. I'm functionally testing a
system that uses a database. Successful tests are guaranteed to
restore the system's data fixtures to initial state, but when tests
fail or error-out we want to do a brute-force re-initialization of the
server so downstream tests can continue. This re-initialization takes
time so we don't want to do it in every tearDown(), just on error/
failure tearDown()'s.
TIA,
Chris
More information about the Python-list
mailing list