Running Tests in Egg Buildouts

A quick note about a gotcha with plone.recipe.zope2instance.ctl

Recently I made an egg of mine into a buildout for self-contained testing and I ran into a gotcha that took me too much time to figure out, so I thought I'd document it for others.

The plone.recipe.zope2instance.ctl test runner excludes the buildout root from the test paths. It gives the reason in the comments:

# XXX Somehow the buildout root gets on the sys.path. This causes
# weird problems, as packages like src.plone.portlets.plone.portlets
# are found by the testrunner

 

Since a ZopeSkel generated egg doesn't create a "src" directory to contain the actuall python packages, the egg root would need to be on the test path. When the egg is made into a buildout then all these factors collide to make the egg I want to test invisible to the test runner.

I worked around this by moving the actual python packages to a "src" directory. I always thought this was more proper anyways. Maybe ZopeSkel should be changed. At any rate, here's the setup.py additions that were necessary:

packages=find_packages('src', exclude=['ez_setup']),
package_dir = {'':'src'},

 

Hope this saves some trouble!

Updated on 14 November 2008

Imported from Plone on Mar 15, 2021. The date for this update is the last modified date in Plone.

Comments

comments powered by Disqus