I would like to repeat a test module N times.
The order is very important.
content of 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
When I run py.test --repeat=2 , the output is:
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] ✓
I don't want it to be repeated per test, but per test module.
Is it possible to have something like that?
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] ✓
try
pytestmark = [pytest.mark.usefixtures('module_scoped_fun')]
at module level with a module scoped parametrized fixture?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.