[Distutils] [zc.buildout] building a testrunner

Chris Withers chris at simplistix.co.uk
Thu Jul 24 23:33:31 CEST 2008


Marius Gedminas wrote:
>> if __name__ == '__main__':
>>     zope.testing.testrunner.run([
>>   '--test-path', '/home/chris/twiddler',
> 
> This is Not Good. 

Right, although Jim said he tried this with the same buildout.cfg and 
didn't experience the problem. I'd love to know what caused that 
different behaviour...

> 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?

> People who use an intermediate 'src/' subdir do not get the problem you
> stumbled upon.  I think an intermediate directory is a Very Good Idea,
> because:

I don't. I hate intermediate directories. I actually hate not being able 
to just put setup.py and buildout.py in the twiddler package and 
distributing one zipped up folder, however I gave up trying to bash 
distutils to do this...

> * 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?

> OTOH if you want to keep your current package layout, you need to
> convince zc.recipe.testrunner to use a different --test-path
> (specifically, '/home/chris/twiddler/twiddler').  I've no idea how to
> achieve this.  I'd choose the other solution (insert a src/ subdir into
> my tree, above the twiddler subdir).

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

>> The only other thing I can think of: do you maybe have "default user 
>> config files" living in ~ that are influencing zope.testing or 
>> zc.recipe.testrunner in some way?
> 
> You can override the egg cache location in a dotfile in your home.
> Power users do that to avoid downloading the same eggs over and over
> again for each project they're working on.

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

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Distutils-SIG mailing list