[Zope-dev] Puzzle re zope.pytest

Baiju M baiju.m.mail at gmail.com
Thu May 17 12:48:18 UTC 2012


On Thu, May 17, 2012 at 5:52 PM, Uli Fouquet <uli at gnufix.de> wrote:
[...snip...]
> The main problem why we got stuck is test separation.
>
> Especially the setup and teardown of ZCA registrations, which should
> happen before and after each single test and might be different for
> certain groups of tests. So we looked for some replacement of the way
> zope.testing layers are doing it, but still could not find anything
> similar in py.test which makes it hard to use already available
> techniques (for instance provided by plone.testing) as there seems to be
> no hook in py.test to trigger this stuff at the right point in time.

Something like this should work:

def pytest_funcarg__app(request):
    """Create app funcarg"""
    return request.cached_setup(
        setup=_get_app,  #this should return an app object
        teardown=_release_app, #destroy things here
        scope='function')

def test_something(app):
   pass

Regards,
Baiju M


More information about the Zope-Dev mailing list