Skip to content

Commit e80580f

Browse files
committed
Move step number to the end of the parametrisation ID
This allows to sort test results on the report tool (Jenkins, Allure) with grouping by test name, not by step number.
1 parent 9587709 commit e80580f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pytest_repeat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __pytest_repeat_step_number(request):
4949
"Please consider raising an issue with your usage.")
5050

5151

52+
@pytest.hookimpl(trylast=True)
5253
def pytest_generate_tests(metafunc):
5354
count = metafunc.config.option.count
5455
if hasattr(metafunc.function, 'repeat'):

test_repeat.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,16 @@ def test_parametrize(self, testdir):
5454
def test_repeat(x):
5555
pass
5656
""")
57-
result = testdir.runpytest('--count', '2')
58-
result.stdout.fnmatch_lines(['*6 passed*'])
57+
result = testdir.runpytest('-v', '--count', '2')
58+
result.stdout.fnmatch_lines([
59+
'*test_parametrize.py::test_repeat[[]a-1/2[]] PASSED*',
60+
'*test_parametrize.py::test_repeat[[]a-2/2[]] PASSED*',
61+
'*test_parametrize.py::test_repeat[[]b-1/2[]] PASSED*',
62+
'*test_parametrize.py::test_repeat[[]b-2/2[]] PASSED*',
63+
'*test_parametrize.py::test_repeat[[]c-1/2[]] PASSED*',
64+
'*test_parametrize.py::test_repeat[[]c-2/2[]] PASSED*',
65+
'*6 passed*',
66+
])
5967
assert result.ret == 0
6068

6169
def test_parametrized_fixture(self, testdir):

0 commit comments

Comments
 (0)