File tree 2 files changed +15
-14
lines changed
2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -34,19 +34,18 @@ class UnexpectedError(Exception):
34
34
pass
35
35
36
36
37
- @pytest .fixture ( autouse = True )
37
+ @pytest .fixture
38
38
def __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." )
50
49
51
50
52
51
@pytest .hookimpl (trylast = True )
@@ -56,6 +55,7 @@ def pytest_generate_tests(metafunc):
56
55
if m is not None :
57
56
count = int (m .args [0 ])
58
57
if count > 1 :
58
+ metafunc .fixturenames .append ("__pytest_repeat_step_number" )
59
59
60
60
def make_progress_id (i , n = count ):
61
61
return '{0}-{1}' .format (i + 1 , n )
Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ class TestRepeat:
11
11
12
12
def test_no_repeat (self , testdir ):
13
13
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
16
17
""" )
17
18
result = testdir .runpytest ('-v' , '--count' , '1' )
18
19
result .stdout .fnmatch_lines ([
You can’t perform that action at this time.
0 commit comments