nose-devs/nose — Issue #336: Patch for: multiprocess "ran 0 tests"
Author: jpellerin
Created: 2011-12-14 16:08:12+00:00
State: closed

I've upgraded to 0.11.1 today and gave the multiprocess feature a
whirl, but didn't work for me: it simply said "Ran 0 tests".

Then I've checked out latest trunk (as of a few hours ago) but same
thing.

So I've had a look at the source and tracked it down to the
interaction between multiprocess.py and LazySuites. It seems as if
multiprocess will get all tests from the same LazySuite multiple
times, but as the comment on LazySuite's test accessor points out,
"Access is through a generator, so iteration may not be repeatable."

I haven't found anyone else complaining about this... why I'm the only
one noticing this is beyond me, there's nothing special about my test
rig. Maybe it has to do with the fact that I invoke "nosetests
/path/foo /path/bar" style?

Anyway, I've found a fix for this issue that doesn't seem to have any
undesirable side effects. Two different fixes more precisely, take
your pick:

Fix #1 preserves the "laziness" of the suite: in the first pass, tests
are taken out of the generator as before, but they're also put into
the precache from where they are served in subsequent passes.

Fix #2 "eats" the generator early (in the setter). This might look to
be the less preferable solution, however in my case it appears to
speed things up by around 35% with two processes (6s vs 8s with fix
#1) and interestingly, without multiprocess as well (8s vs 10s with
current, unmodified trunk.)

In short, may I suggest to apply fix #2: it fixes a bug with
multiprocess and speeds things up generally.

If you believe that it's only my situation where lazy loading is
detrimental to performance (running from slow-ish NFS here, could that
have to do with it?) then fix #1 might be the way to go. In this
case, however, could a flag be added to enable non-laziness?

Google Code Info:
Issue #: 270
Author: julian...@gmail.com
Created On: 2009-05-28T11:06:22.000Z
Closed On: 2009-05-30T20:57:32.000Z