我想重复一次测试模块N次 订单非常重要。
test_stress.py的内容
import pytest
@pytest.mark.usefixtures("class_setup_teardown")
class TestStressRobot:
def test_1(self):
print "\nstressing part 1..."
assert True
def test_2(self):
print "\nstressing part 2..."
assert True
def test_3(self):
print "\nstressing part 3..."
assert True
当我运行 py.test --repeat = 2 时,输出为:
test_stress.pyTestStressRobot.test_1 [0]✓
test_stress.pyTestStressRobot.test_1 [1]✓
test_stress.pyTestStressRobot.test_2 [0]✓
test_stress.pyTestStressRobot.test_2 [1]✓
test_stress.pyTestStressRobot.test_3 [0]✓
test_stress.pyTestStressRobot.test_3 [1]✓
我不希望每次测试都重复它,但是每个测试模块。
有可能有类似的东西吗?
test_stress.pyTestStressRobot.test_1 [0]✓
test_stress.pyTestStressRobot.test_2 [0]✓
test_stress.pyTestStressRobot.test_3 [0]✓
test_stress.pyTestStressRobot.test_1 [1]✓
test_stress.pyTestStressRobot.test_2 [1]✓
test_stress.pyTestStressRobot.test_3 [1]✓
答案 0 :(得分:0)
试
pytestmark = [pytest.mark.usefixtures('module_scoped_fun')]
在模块级别,带有模块范围的参数化夹具?
答案 1 :(得分:0)