[TIP] Testing the Fixture?

Titus Brown titus at caltech.edu
Wed Nov 21 16:41:29 PST 2007


-> Could you manually throw an exception that aborts all the remaining
-> tests? Would there a point to that?
-> 
-> # module setup
-> setup():
->   try:
->     assert some stuff, 'fixture failed, bailing out'
->   catch:
->     raise KillerException

I think someone else answered with the magic bit of code that does this!

I, however, would argue that this is a bad idea: tests should fail or
they should succeed.  Having code that relies on local code trickiness
to ignore or halt successive tests seems like a fantastic way to lose
test code.

I personally use tags and attributes to run subsets appropriate to the
platform and installation that I am running on; that gives me an
explicit place on the command line to specify which code to ignore,
which in turn prevents me from losing the code.

cheers,
--titus



More information about the testing-in-python mailing list