[Zope3-dev] classes as zope.testing layers

Bernd Dorn bernd.dorn at lovelysystems.com
Tue May 1 16:53:51 EDT 2007


hi rosss

maybe http://svn.zope.org/z3c.testing/ is intresting for you

z3c.testing.layer.defineLayer takes an optinal appSetUp keyword,  
which should be a callable that takes the rootfolder as argument

regards, bernd

On 01.05.2007, at 20:07, Ross Patterson wrote:

> 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
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/bernd.dorn% 
> 40lovelysystems.com
>



More information about the Zope3-dev mailing list