Skip to content. | Skip to navigation

Personal tools


You are here: Home / Blog / Running Tests in Egg Buildouts

Running Tests in Egg Buildouts

by Ross Patterson last modified Nov 15, 2008 05:28 AM
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 additions that were necessary:

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


Hope this saves some trouble!

OpenID Login


IRC: rossp
Yahoo IM: patterson_ross
AIM: rosspatters
Skype: merpattersonnet

PO Box 7775 #10587
San Francisco, CA

+1 (415) 894-5323