Fix --sw crash when first file in cmdline fails to collect

Fix #5444
This commit is contained in:
Bruno Oliveira
2019-06-13 16:45:27 -03:00
committed by Bruno Oliveira
parent 0fc11b6f3c
commit e2fa2b621c
3 changed files with 17 additions and 11 deletions
+2 -1
View File
@@ -29,6 +29,7 @@ class StepwisePlugin:
self.config = config
self.active = config.getvalue("stepwise")
self.session = None
self.report_status = ""
if self.active:
self.lastfailed = config.cache.get("cache/stepwise", None)
@@ -104,7 +105,7 @@ class StepwisePlugin:
self.lastfailed = None
def pytest_report_collectionfinish(self):
if self.active and self.config.getoption("verbose") >= 0:
if self.active and self.config.getoption("verbose") >= 0 and self.report_status:
return "stepwise: %s" % self.report_status
def pytest_sessionfinish(self, session):