[TIP] Running tox on several jenkins jobs are the same time sometimes throws an error

holger krekel holger at merlinux.eu
Tue Feb 19 06:58:01 PST 2013


Hi Pedrod,

On Mon, Feb 18, 2013 at 14:50 -0500, Pedro Rodriguez wrote:
> I'm using Tox with Jenkins to run several selenium tests. Everything is
> good but every now and then I get the follow error:
> 
> IOError: [Errno 2] No such file or directory: '/var/lib/jenkins/.tox/
> jenkins/lib/python2.7/site-packages/Distutils-1.0-py2.7.egg-info'
> 
> Looking at the log (when it works), I think the issue is this:
> 
> Installing collected packages: Distutils
> 
>   Found existing installation: Distutils 1.0
> 
>     Uninstalling Distutils:
> 
>       Removing file or directory
> /var/lib/jenkins/.tox/jenkins/lib/python2.7/site-packages/Distutils-1.0-py2.7.egg-info
>       Successfully uninstalled Distutils
> 
> I think what is happening is that if 2 or more tox are running at the same
> time, while one is Uninstalling Distutils, then another one tries to do the
> same thing (and since the other one already did it, it can't find it and
> throws an IO error).

I am not sure i follow.  There should only ever be one tox instance running
things per virtualenv.  Are you suggesting there are two tox processes
working on the same virtualenv?

> So:
> ToxA -> Finds the Distutils installation
> ToxB -> Also finds it
> ToxA -> Delete it
> ToxB -> Try to delete (fails)
> 
> So my questions are:
> - Why is Distutils being deleted? (noob when it comes to it)

i don't know - it's not something that tox deals with itself.

> - Is there a way to avoid this?
> - How are you guys using Tox with Jenkins? I'm just calling tox -e jenkins
> path/to/test.py. Is there a better way?

did you look at: http://testrun.org/tox/latest//example/jenkins.html ?

> - sbt and other building tools usually have locking mechanisms for these
> kind of things. Why doesn't Tox? (if it does, how do I turn it on?).

There is "detox" which runs tests in parallel but it takes care itself
to not have more than one "tox" instance running per virtualenv.

best,
holger



More information about the testing-in-python mailing list