You are here: Home Blog Running Tests in Egg Buildouts

Running Tests in Egg Buildouts

by Ross Patterson last modified Nov 14, 2008 08:28 PM
— filed under: , ,

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!

Document Actions

too late... :)

Posted by http://witsch.zitc.de/ at Mar 11, 2009 07:03 AM
i had to find out the hard way. but it's great someone finally blogged about it! :)

too late... :)

Posted by Ross Patterson at Mar 11, 2009 09:02 AM
Well that should teach you to ignore my blog! ;)
Contact

me@rpatterson.net

IRC: zenwryly@irc.freenode.net
GTalk: merpattersonnet@gmail.com
Yahoo IM: patterson_ross
AIM: rosspatters
MSN: me@rpatterson.net
Skype: merpattersonnet

831-338-9197
Fax: 831-480-5894

PO Box 7775 #10587
San Francisco, CA
94120-7775