问题描述
是否可以使用 nose
进行单个测试同时(跨多个进程)并将结果汇总为单个通过/失败结果?
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 have the need to run the same test multiple times concurrently to ensure resource locking isn't being affected. If nose can't do this, is there a specific testing/design pattern to follow to achieve this?
推荐答案
可以与鼻子同时进行测试:
我已经调整了插件以根据需要并行运行单个测试.从 http://paste.pocoo.org/show/319470/下载并另存为nose/plugins/repeat.py
.然后,在nose/plugins/builtin.py
中,将行('nose.plugins.repeat', 'RepeatMultiProcess'),
添加到builtins
.像这样打电话:
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
这篇关于是否可以同时使用Nose进行一次测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!