Installing a python package for tests
Martin Aspeli
optilude at gmx.net
Fri Sep 14 20:57:02 UTC 2007
Sidnei da Silva wrote:
> I have a test that now needs to install plone.session since I'm updating
> this product to Plone 3.0. Apparently I need to call installPackage, but
> installPackage checks if registerPackage has been called, so I have to call
> registerPackage too, or load the zcml. This doesn't sound right to me.
> Anyone documented this already?
You need to separate ZCML processing from Zope product loading in your mind.
plone.session is probably not a Zope 2 product. Then, you don't need
installPackage at all. You can just use it so long as it's in your
pythonpath. You may need to load its ZCML in a test layer, of course.
installPackage() is needed only for Zope 2 products. To be a Zope 2
product, a package needs to use <five:registerPackage /> in its ZCML,
and this needs to have been loaded before installPackage() is called.
Here's an example that hooks into the PloneTestCase main Plone ZCML
layer. It loads some ZCML and installs a package as a product with
installPackage().
http://dev.plone.org/collective/browser/borg/components/borg.project/trunk/borg/project/tests.py
Martin
--
Acquisition is a jealous mistress
More information about the Product-Developers
mailing list