3

I can't run nose with several processes programmatically.

This works...:

PYTHONPATH="/home/developer/Downloads/unittest2-0.5.1:" nosetests --processes=4 

It spawns 4 browsers at once.

When running this in eclipse however, it runs them one by one.

nose.run(defaultTest="",argv=['--processes=4','--verbose', '--process-timeout=30'])

I know the arguments are kicking in because I can see a difference with the verbose argument.

Cœur
  • 37,241
  • 25
  • 195
  • 267
dgrandes
  • 1,187
  • 2
  • 14
  • 28
  • potentially a duplicate question: http://stackoverflow.com/questions/3111915/getting-tests-to-parallelize-using-nose-in-python – Dmitry B. Nov 21 '11 at 16:25
  • I actually read that question before asking. I think its not a duplicate question because the other user cannot "see" the test ocurring in parallel. I can see them, (they are selenium tests and a browser spans per test). The difference is that it only happens from the command line, not from code (ie Eclipse). – dgrandes Nov 21 '11 at 20:30

1 Answers1

7

The answer was a bit tricky!

For some reason, nose.run ignores the first argument it receives.

This actually works:

nose.run(defaultTest="",argv=['','--processes=4','--verbose', '--process-timeout=90'])

This answers the question's dilemma perfectly: "I know the arguments are kicking in because I can see a difference with the verbose argument." :)

dgrandes
  • 1,187
  • 2
  • 14
  • 28
  • 3
    The first element of `argv` is the program name itself. In the [docs](http://nose.readthedocs.org/en/latest/doc_tests/test_multiprocess/multiprocess.html) you can see that it's always `'nosetests'`. – Ian Mackinnon Jun 02 '15 at 17:34