minor: LFPlugin: de-indent code by returning if not active

This commit is contained in:
Daniel Hahler 2019-04-07 15:03:22 +02:00
parent 19035f4b55
commit 1d137fd2fe
1 changed files with 35 additions and 35 deletions

View File

@ -179,7 +179,9 @@ class LFPlugin(object):
self.lastfailed[report.nodeid] = True
def pytest_collection_modifyitems(self, session, config, items):
if self.active:
if not self.active:
return
if self.lastfailed:
previously_failed = []
previously_passed = []
@ -203,9 +205,7 @@ class LFPlugin(object):
else: # --failedfirst
items[:] = previously_failed + previously_passed
noun = (
"failure" if self._previously_failed_count == 1 else "failures"
)
noun = "failure" if self._previously_failed_count == 1 else "failures"
suffix = " first" if self.config.getoption("failedfirst") else ""
self._report_status = "rerun previous {count} {noun}{suffix}".format(
count=self._previously_failed_count, suffix=suffix, noun=noun