[Grok-dev] z3c.testsetup and layers

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Oct 26 12:03:49 EDT 2009


Jan-Wijbrand Kolman wrote:
snip
> * You have to make sure all setups and teardown methods in the test 
> layer inheritance hierarchy are called in the correct order::
> 
>    class MyFunctionalLayer(zope.app.testing.functional.ZCMLLayer):
> 
>        def setUp(self):
>            super(MyFunctionalLayer, self).setUp()
>            # and now my stuff
> 
>        def tearDown(self):
>            # first my stuff
>            super(MyFunctionalLayer, self).tearDown()


I made a mistake in this example. Since ZCMLLayer is an old-style class, 
you cannot use "super". The example should read:

    class MyFunctionalLayer(zope.app.testing.functional.ZCMLLayer):

        def setUp(self):
            zope.app.testing.functional.ZCMLLayer.setUp(self)
            # and now my stuff

        def tearDown(self):
            # first my stuff
            zope.app.testing.functional.ZCMLLayer.tearDown(self)


regards,
jw




More information about the Grok-dev mailing list