[Product-Developers] Setting up enough zcml in testing
Maurits van Rees
m.van.rees at zestsoftware.nl
Fri Jan 23 12:32:12 UTC 2009
Hi,
I am trying to get the roadrunner testrunner working in my buildout.
See http://pypi.python.org/pypi/roadrunner
roadrunner speeds up testing by preloading a standard Zope and Plone
test environment compatible with PloneTestCase.
For this to work, the test setup in your product/package needs to be
pretty good. Following these guidelines should be enough:
http://plone.org/documentation/tutorial/testing/writing-a-plonetestcase-unit-integration-test
I added it in this buildout:
https://svn.plone.org/svn/collective/Products.eXtremeManagement/buildout/trunk
bin/roadrunner -s Products.eXtremeManagement now works.
bin/roadrunner -s xm.tracker gives errors, because not enough (meta)
zcml is loaded; on the other hand, 'bin/instance test -s xm.tracker'
works fine. The xm.tracker tests use the layer and setup defined in
Products.eXtremeManagement, so I would expect that roadrunner then
also works for both. Test errors are for instance this one:
ConfigurationError: ('Unknown directive',
u'http://namespaces.zope.org/zope', u'permission')
I have begun fixing this and similar errors with extra lines in a
Products.PloneTestCase.layer.onsetup function. I currently already
have this:
fiveconfigure.debug_mode = True
import zope.security
import zope.component
import Products.Five
import kss.core
import Products.GenericSetup
import plone.app.portlets
import Products.CMFCore
import Products.CMFDynamicViewFTI
import Products.DCWorkflow
zcml.load_config('meta.zcml', zope.security)
zcml.load_config('meta.zcml', zope.component)
zcml.load_config('meta.zcml', Products.Five)
zcml.load_config('meta.zcml', Products.Five.viewlet)
zcml.load_config('meta.zcml', kss.core.pluginregistry)
zcml.load_config('meta.zcml', Products.GenericSetup)
zcml.load_config('meta.zcml', plone.app.portlets)
zcml.load_config('meta.zcml', Products.CMFCore)
zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.CMFDynamicViewFTI)
zcml.load_config('tool.zcml', Products.DCWorkflow)
All those lines help. But they are not enough, as I now get this error:
zope.component.interfaces.ComponentLookupError: (<InterfaceClass
Products.MailHost.interfaces.IMailHost>, u'')
That one is probably fixable as well. But there has *got* to be a
better way, with less lines, that actually works and lets me have the
time gains promised by roadrunner. So... what is it? :-)
--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]
More information about the Product-Developers
mailing list