[TIP] Problems running tox on Jenkins

Adrian Petrescu apetresc at gmail.com
Wed Jun 6 23:12:43 PDT 2012


Hey guys,

I have a fairly simple 3-module python project that I'm testing
successfully using Tox, on Python 2.6 and 2.7. The tox configuration is
almost completely vanilla, nothing special there. Everything works fine
when I run tox directly on my OS X development machine.

However, things go wrong when trying to run this on my Jenkins server
(running Ubuntu 12.04). I have tried to set up Tox to run both directly
through the Python plugin for Jenkins (where I invoke Tox directly from a
Python script using tox.cmdline()) as well as through the ShiningPanda
plugin. In both cases, and for both Python 2.6 and 2.7, I get the following
error:

_________________________________ [tox sdist]
__________________________________ [TOX] ***creating sdist package [TOX]
/var/lib/jenkins/workspace/Service Templates/TOXENV/py27/scripts$
/usr/bin/python setup.py sdist --formats=zip --dist-dir .tox/dist
>.tox/log/0.log [TOX] ***copying new sdistfile to
'/var/lib/jenkins/workspace/Service
Templates/TOXENV/py27/scripts/.tox/distshare/ServiceTemplates-1.0.zip'
______________________________ [tox testenv:py27]
______________________________ [TOX] ***creating virtualenv py27 [TOX]
/var/lib/jenkins/workspace/Service Templates/TOXENV/py27/scripts/.tox$
/usr/bin/python2.7
/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py
--distribute --no-site-packages py27 >py27/log/0.log [TOX] ERROR:
invocation failed, logfile: /var/lib/jenkins/workspace/Service
Templates/TOXENV/py27/scripts/.tox/py27/log/0.log [TOX] ERROR:
/var/lib/jenkins/workspace/Service Templates/TOXENV/py27/scripts/.tox$
/usr/bin/python2.7
/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.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
Installing
distribute.............................................................................................................................................................................................done.
Installing pip... Error [Errno 2] No such file or directory while executing
command /var/lib/jenkins/wor...y27/bin/easy_install
/usr/local/lib/pytho...pport/pip-1.1.tar.gz ...Installing pip...done.
Traceback (most recent call last): File
"/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",
line 2270, in <module> main() File
"/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",
line 928, in main never_download=options.never_download) File
"/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",
line 1042, in create_environment install_pip(py_executable,
search_dirs=search_dirs, never_download=never_download) File
"/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",
line 640, in install_pip filter_stdout=_filter_setup) File
"/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py",
line 966, in call_subprocess cwd=cwd, env=env) File
"/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread,
errwrite) File "/usr/lib/python2.7/subprocess.py", line 1249, in
_execute_child raise child_exception OSError: [Errno 2] No such file or
directory [TOX] ERROR: InvocationError: /usr/bin/python2.7
/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py
--distribute --no-site-packages py27 (see
/var/lib/jenkins/workspace/Service
Templates/TOXENV/py27/scripts/.tox/py27/log/0.log)
________________________________ [tox summary]
_________________________________ [TOX] ERROR: py27: InvocationError:
/usr/bin/python2.7
/usr/local/lib/python2.7/dist-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py
--distribute --no-site-packages py27 (see
/var/lib/jenkins/workspace/Service
Templates/TOXENV/py27/scripts/.tox/py27/log/0.log) Build step 'Execute
Python script' marked build as failure Recording test results Finished:
FAILURE

The baffling part is that *running tox directly on the Linux box, even as
the jenkins user, works just fine!* This issue *only* shows up when run
through Jenkins, but in that case it shows up no matter how I invoke it
(ShiningPanda, Python, etc.).

I feel I must have a simple misconfiguration here, but the stack trace is
completely opaque to me. Does anyone have any insight they can provide?

Thanks!
-Adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120607/eafb8fc5/attachment.htm>


More information about the testing-in-python mailing list