[z3-five] testings event firing
Daniel Nouri
daniel at infrae.com
Thu Feb 8 10:50:22 CET 2007
Chris Withers wrote:
> Philipp von Weitershausen wrote:
>> Sure, or simply use an already existing setup from
>> zope.component.eventtesting.
>
> ...which is only available in 2.10 ;-)
>
>> In a functional test, you load the ZCML once for a whole bunch of tests
>> and then execute all your tests within that setup.
>
> What's the canonical way to load all the zcml that Zope normally does?
>
>> shouldn't really modify the registries then. The common way to do this
>> is to use zope.testing's test layer support. You put those tests that
>> require common setup routines that may take long to load (e.g. booting
>> up all of the ZCML you have) into one layer and let the layer do that
>> setup (and tear down). zope.testing has some doctests on layers.
>
> Yup, I've read all those I could find, but I'm still left wondering how
> to fire up all the ZCML ;-)
I know you wouldn't look at Plone for an example :p so here's an example
from Silva:
https://infrae.com/svn/Silva/branch/zope-2.10/tests/layer.py
Look at SilvaZCMLLayer, which does the setup for all of Silva's
integration tests. It has ``zcml.load_site()`` and it also registers a
subscriber for anything (for which you can use your own list just as well).
--
Daniel Nouri
Infrae × http://infrae.com
More information about the z3-five
mailing list