File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed
Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -34,19 +34,18 @@ class UnexpectedError(Exception):
3434 pass
3535
3636
37- @pytest .fixture ( autouse = True )
37+ @pytest .fixture
3838def __pytest_repeat_step_number (request ):
39- if request .config .option .count > 1 :
40- try :
41- return request .param
42- except AttributeError :
43- if issubclass (request .cls , TestCase ):
44- warnings .warn (
45- "Repeating unittest class tests not supported" )
46- else :
47- raise UnexpectedError (
48- "This call couldn't work with pytest-repeat. "
49- "Please consider raising an issue with your usage." )
39+ try :
40+ return request .param
41+ except AttributeError :
42+ if issubclass (request .cls , TestCase ):
43+ warnings .warn (
44+ "Repeating unittest class tests not supported" )
45+ else :
46+ raise UnexpectedError (
47+ "This call couldn't work with pytest-repeat. "
48+ "Please consider raising an issue with your usage." )
5049
5150
5251@pytest .hookimpl (trylast = True )
@@ -56,6 +55,7 @@ def pytest_generate_tests(metafunc):
5655 if m is not None :
5756 count = int (m .args [0 ])
5857 if count > 1 :
58+ metafunc .fixturenames .append ("__pytest_repeat_step_number" )
5959
6060 def make_progress_id (i , n = count ):
6161 return '{0}-{1}' .format (i + 1 , n )
Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ class TestRepeat:
1111
1212 def test_no_repeat (self , testdir ):
1313 testdir .makepyfile ("""
14- def test_no_repeat():
15- pass
14+ def test_no_repeat(request):
15+ fixtures = request.fixturenames
16+ assert "__pytest_repeat_step_number" not in fixtures
1617 """ )
1718 result = testdir .runpytest ('-v' , '--count' , '1' )
1819 result .stdout .fnmatch_lines ([
You can’t perform that action at this time.
0 commit comments