[Distutils] [zc.buildout] building a testrunner

Marius Gedminas marius at pov.lt
Fri Jul 25 12:02:54 CEST 2008

Context: Test runner gets confused by the egg cache that lives under its

On Thu, Jul 24, 2008 at 05:14:33PM -0400, Jim Fulton wrote:
> Arguably, the test runner recipe should be able to deal with this  
> case.  I view this as a bug. It would be great if someone reported  
> it. :)

I'll report it.

On Thu, Jul 24, 2008 at 10:33:31PM +0100, Chris Withers wrote:
> Marius Gedminas wrote:
> >>if __name__ == '__main__':
> >>    zope.testing.testrunner.run([
> >>  '--test-path', '/home/chris/twiddler',
> >You don't want the test runner to look for tests
> >under /home/chris/twiddler/, which contains the egg cache directly under
> >it, as well as your Python packages.
> But these module names don't match any test pattern so why would they be 
> found?

Because they contain submodules that do match the test pattern, IIUC.

> >* you want to be able to import 'twiddler', which means
> >  /home/chris/twiddler/ must be in you sys.path
> Right.
> >* you don't want setup.py or bootstrap.py to be in your sys.path, which
> >  contradicts the above requirement
> Why don't I want them in my sys.path?

Uh, because otherwise my argument breaks down completely.  ;-)

I suppose it's a matter of purity.  I feel about extra files lying on my
sys.path about the same as I feel about ending statements with
semicolons in Python.

> I'm not sure I quite by this, I don't understand why zope.testing is 
> trying to import something like:
> eggs.zc.buildout-1.1.0-py2.5.egg.zc.buildout.tests

It found a directory named 'tests' under


and naively converted the slashes to periods, assuming that the root of
the search three (i.e. the path passed with --test-path) is on your

I agree that this is a bug.  It can be fixed by:

  - not recursing into subdirectories with names that are invalid Python
    module names

  - not recursing into subdirectories that don't have a __init__ (and
    eggs/ certainly doesn't, I hope)

> That sounds like a good idea, but I'd prefer to solve this problem for 
> anyone who might want to develop packages of mine.

Agreed.  Bug filed as https://bugs.launchpad.net/zope.testing/+bug/251759

Marius Gedminas
The memory management on the PowerPC can be used to frighten small children.
                -- Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20080725/73eb852c/attachment.pgp>

More information about the Distutils-SIG mailing list