Re: Puzzle re zope.pytest

Baiju M <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <CAN8ZCbx4aQeuYKsJtbjimjsx5Kqm4jn2=XaMvzrxCw6m2q0Faw@mail.gmail.com>
On Thu, May 17, 2012 at 5:52 PM, Uli Fouquet <[email protected]> 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
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.