Is it possible to use nose to run a single test concurrently (across multiple processes) and aggregate the result in to a single pass/fail result?
We ha
It is possible to run tests concurrently with nose:
Using the nose.plugin.multiprocess plugin, you can parallelize a test run across a configurable number of worker processes. While this can speed up CPU-bound test runs, it is mainly useful for IO-bound tests that spend most of their time waiting for data to arrive from someplace else and can benefit from parallelization.
I've adapted the plugin to run a single test in parallel as you want. Download from http://paste.pocoo.org/show/319470/ and save as nose/plugins/repeat.py
. Then, in nose/plugins/builtin.py
, add the line ('nose.plugins.repeat', 'RepeatMultiProcess'),
to builtins
. Call like this:
c:\python27\python nose-1.0.0\selftest.py --repeat-processes=2 --repeat-times=3 test2.py
Note: setup/teardown support might be broken. If so, the fix is simple, see comment in line
This seems like something you want in the test definition itself because you want to assert on the aggregation of the results. I would take a look at using multiprocessing in the test. Create a pool to execute your code in parallel. You can use a Queue to aggregate the results.