[Zope3-dev] Test Layers

Chris Withers chris at simplistix.co.uk
Tue Oct 17 08:02:40 EDT 2006


Martin Aspeli wrote:
> 
> Layers are ... layered. If your test base class has layer X and a test case
> subclass of that has layer Y, then it will set up X, run all the X tests,
> then setup Y and run all the Y and X&Y tests, then tear down Y and then X.

I didn't mention subclassing tests. Personally, I think that's evil...

> I did this in Plone recently, but it completely escapes me where. Maybe I'll
> have an epiphany after lunch, but look at how the ZCML layer in
> PloneTestCase trunk works (it sets up all kinds of ZCML) and then try to
> derive a class from PloneTestCase (or your equivalent) and set layer =
> myLayer.

What layer(s) would the following test be executed in:

class BaseX(TestCase):

    layer = 'X'

class BaseY(TestCase):

    layer = 'Y'

class SomeTests(BaseX,BaseY):

    def test_1(self):
        pass

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope3-dev mailing list