[Zope-dev] Re: ZCML and 'zopectl test'?

Philipp von Weitershausen philipp at weitershausen.de
Sun Jan 7 06:14:32 EST 2007


Andreas Jung wrote:
> I added Products/PageTemplates/configure.zcml to register an utility.
> That works fine when running Zope however "zopectl test" won't work 
> properly anymore because the utility registration does not seem to 
> happen when running the tests. Bug or feature?

Tests need to do their own setup. ZCML isn't magically loaded for tests, 
unless those tests are run within a layer that loads all ZCML before 
running the tests.

So, there are two options:
- modify the setUp() of the tests in question to 
provideUtility(your_utility)
- make the respective tests run in a layer that loads the ZCML. I don't 
think layer support is on the trunk yet. Whit Morriss has a branch where 
he added that to Zope 2, but it still hasn't been merged :(

Philipp

-- 
http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!


More information about the Zope-Dev mailing list