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

Pedro Rodriguez vondiefinsternis at gmail.com
Tue Feb 19 07:13:20 PST 2013


Lets say I have 5 selenium test files (test1.py.....test5.py). In Jenkins,
the usual way you want to run your tests is in parallel (each a different
job) so that you know easier when something broke (send emails, mark builds
as fail, etc etc).

So I run things, per job, as:
[job1] tox test1.py
[job2] tox test2.py
[job3] tox test3.py
....

Now when I launch them, some of them, some times, fail because of the error
above. I know I could just run "tox" and it will run all tests, but then I
lose cool jenkin stuff like being able to tell which test failed easily (if
one fails in one file, the whole build fails). I could just run them as
"py.test" instead of tox, but that's annoying (deps, multi-conf, etc).

Detox? Sounds promising. I'll take a look. Thanks!

~Pedro


On Tue, Feb 19, 2013 at 9:58 AM, holger krekel <holger at merlinux.eu> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130219/47679f20/attachment.html>


More information about the testing-in-python mailing list