@@ -8,7 +8,7 @@ def pytest_addoption(parser):
8
8
"--stepwise" ,
9
9
action = "store_true" ,
10
10
dest = "stepwise" ,
11
- help = "exit on test fail and continue from last failing test next time" ,
11
+ help = "exit on test failure and continue from last failing test next time" ,
12
12
)
13
13
group .addoption (
14
14
"--stepwise-skip" ,
@@ -37,7 +37,10 @@ def pytest_sessionstart(self, session):
37
37
self .session = session
38
38
39
39
def pytest_collection_modifyitems (self , session , config , items ):
40
- if not self .active or not self .lastfailed :
40
+ if not self .active :
41
+ return
42
+ if not self .lastfailed :
43
+ self .report_status = "no previously failed tests, not skipping."
41
44
return
42
45
43
46
already_passed = []
@@ -54,7 +57,12 @@ def pytest_collection_modifyitems(self, session, config, items):
54
57
# If the previously failed test was not found among the test items,
55
58
# do not skip any tests.
56
59
if not found :
60
+ self .report_status = "previously failed test not found, not skipping."
57
61
already_passed = []
62
+ else :
63
+ self .report_status = "skipping {} already passed items." .format (
64
+ len (already_passed )
65
+ )
58
66
59
67
for item in already_passed :
60
68
items .remove (item )
@@ -94,6 +102,10 @@ def pytest_runtest_logreport(self, report):
94
102
if report .nodeid == self .lastfailed :
95
103
self .lastfailed = None
96
104
105
+ def pytest_report_collectionfinish (self ):
106
+ if self .active and self .config .getoption ("verbose" ) >= 0 :
107
+ return "stepwise: %s" % self .report_status
108
+
97
109
def pytest_sessionfinish (self , session ):
98
110
if self .active :
99
111
self .config .cache .set ("cache/stepwise" , self .lastfailed )
0 commit comments