I recently ran into a gotcha using classes as zope.testing layers.  My
layer class didn't define tearDown so it's base class tearDown method
was called when my layer was supposed to be torn down.

It seems like a minor pain to me to have to define tearDown, testSetUp,
and testTearDown in a layer where I'm only actually using setUp, so I'm
wondering what is The Right Way (tm) to do this?  Is the problem that
using classes as layers is an abuse of classes?  If so, what is the best
practice for writing a layer?  Is the problem that I should be explicit
and jsut get over my aversion to explicitly defining emtpy tearDown,
testSetUp, and testTearDown methods?  Or is the problem that
zope.testing.testrunner should check layer.__dict__ for these callables
rather than using hasattr(layer, 'tearDown') as it currently does?

I'm kinda hoping it's the latter.  If so, I can make commits to this
effect, just as soon as I can figure out how to run the zope.testing
tests.  Speaking of which, how do I?  :)


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to