[Zope3-dev] classes as zope.testing layers

Ross Patterson me at rpatterson.net
Tue May 1 14:07:21 EDT 2007


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?  :)

Ross



More information about the Zope3-dev mailing list