[TIP] tox vs buildout

holger krekel holger at merlinux.eu
Fri Dec 16 14:49:00 PST 2011

On Fri, Dec 16, 2011 at 08:09 +0000, Chris Withers wrote:
> On 14/12/2011 11:05, holger krekel wrote:
> >There is an undocumented option of specifying sdistsrc=PATH
> >in the [tox] section.  That might help.
> This is great :-)
> I'd suggest documenting this and making it official!
> So, I'm a lot further on now, I have three outstanding concerns:
> - testing dependencies
> It seems that my current practice of doing the equivalent of running
> "python setup.py testfixtures[test]" to install the testing
> dependencies isn't enough.
> What would work with tox? Can I pip install from a requirements file
> to get my test dependencies to be installed? If so, what should I
> put in my tox.ini to make sure I install into the right tox
> virtualenv?

usually you would specify "deps=" in the testenv to multiline-list your

Pending customized installation there is no way to customize
pip-installation like suggested.

> - what code is being run and tested?
> From my current best run:
> [TOX] /Users/chris/LocalGIT/testfixtures/.tox/py26/log$ ../bin/pip
> install
> --download-cache=/Users/chris/LocalGIT/testfixtures/.tox/_download
> -U --no-deps ../../../dist/testfixtures-2.3.3.tar.gz >3.log
> [TOX] /Users/chris/LocalGIT/testfixtures$ .tox/py26/bin/nosetests
> Now, as read, nose will scan for tests in (and might well import
> software from!) my checkout, rather than the sdist that's just been
> installed. What's the tox-recommended way of avoiding this?
> Put "cd .tox" as one of my commands?
> Can I specify that the working directory should be the current
> virtualenv that tox is using?

testenv-setting: changedir=XYZ, see also http://tox.testrun.org/latest/config.html
Can you not tell nose to run tests from the installed package?
In py.test you would do "py.test --pyargs PKG" which would force it
to first look for the installed package and then perform collection there.

> - EPD Python2.7 versus virtualenv
> So, my Python 2.7 comes from EPD on Mac OS X, and Tox complains
> about this as follows:
> [TOX] /Users/chris/LocalGIT/testfixtures/.tox$
> /Library/Frameworks/EPD64.framework/Versions/7.1/bin/python2.7
> /Users/chris/buildout-eggs/virtualenv-1.7-py2.6.egg/virtualenv.py
> --distribute --no-site-packages py27 >py27/log/0.log
> [TOX] ERROR: invocation failed, logfile:
> /Users/chris/LocalGIT/testfixtures/.tox/py27/log/0.log
> [TOX] ERROR: /Users/chris/LocalGIT/testfixtures/.tox$
> /Library/Frameworks/EPD64.framework/Versions/7.1/bin/python2.7
> /Users/chris/buildout-eggs/virtualenv-1.7-py2.6.egg/virtualenv.py
> --distribute --no-site-packages py27 >py27/log/0.log
> The --no-site-packages flag is deprecated; it is now the default behavior.
> New python executable in py27/bin/python2.7
> Also creating executable in py27/bin/python
> ERROR: The executable py27/bin/python2.7 is not functioning
> ERROR: It thinks sys.prefix is
> u'/Library/Frameworks/EPD64.framework/Versions/7.1' (should be
> u'/Users/chris/LocalGIT/testfixtures/.tox/py27')
> ERROR: virtualenv is not compatible with this system or executable
> [TOX] ERROR: InvocationError:
> /Library/Frameworks/EPD64.framework/Versions/7.1/bin/python2.7
> /Users/chris/buildout-eggs/virtualenv-1.7-py2.6.egg/virtualenv.py
> --distribute --no-site-packages py27 (see
> /Users/chris/LocalGIT/testfixtures/.tox/py27/log/0.log)
> What's wrong here?
> Also, why is Tox using
> Users/chris/buildout-eggs/virtualenv-1.7-py2.6.egg/virtualenv.py ?

I am not sure.  What would you expect to see used instead of this file?
Does a raw virtualenv invocation with the same arguments as above work?


More information about the testing-in-python mailing list