Is it possible to use Nose to run one test multiple times, concurrently?

后端 未结 2 697
情书的邮戳
情书的邮戳 2021-02-14 15:44

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

相关标签:
2条回答
  • 2021-02-14 16:17

    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

    0 讨论(0)
  • 2021-02-14 16:27

    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.

    0 讨论(0)
提交回复
热议问题