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

后端 未结 2 696
情书的邮戳
情书的邮戳 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    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

提交回复
热议问题