diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/pytest/py2/_pytest/stepwise.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/pytest/py2/_pytest/stepwise.py')
-rw-r--r-- | contrib/python/pytest/py2/_pytest/stepwise.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/contrib/python/pytest/py2/_pytest/stepwise.py b/contrib/python/pytest/py2/_pytest/stepwise.py index 83fb4727cd..8890259589 100644 --- a/contrib/python/pytest/py2/_pytest/stepwise.py +++ b/contrib/python/pytest/py2/_pytest/stepwise.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- import pytest @@ -9,7 +9,7 @@ def pytest_addoption(parser): "--stepwise", action="store_true", dest="stepwise", - help="exit on test failure and continue from last failing test next time", + help="exit on test failure and continue from last failing test next time", ) group.addoption( "--stepwise-skip", @@ -29,7 +29,7 @@ class StepwisePlugin: self.config = config self.active = config.getvalue("stepwise") self.session = None - self.report_status = "" + self.report_status = "" if self.active: self.lastfailed = config.cache.get("cache/stepwise", None) @@ -39,11 +39,11 @@ class StepwisePlugin: self.session = session def pytest_collection_modifyitems(self, session, config, items): - if not self.active: + if not self.active: + return + if not self.lastfailed: + self.report_status = "no previously failed tests, not skipping." return - if not self.lastfailed: - self.report_status = "no previously failed tests, not skipping." - return already_passed = [] found = False @@ -59,12 +59,12 @@ class StepwisePlugin: # If the previously failed test was not found among the test items, # do not skip any tests. if not found: - self.report_status = "previously failed test not found, not skipping." + self.report_status = "previously failed test not found, not skipping." already_passed = [] - else: - self.report_status = "skipping {} already passed items.".format( - len(already_passed) - ) + else: + self.report_status = "skipping {} already passed items.".format( + len(already_passed) + ) for item in already_passed: items.remove(item) @@ -72,7 +72,7 @@ class StepwisePlugin: config.hook.pytest_deselected(items=already_passed) def pytest_runtest_logreport(self, report): - if not self.active: + if not self.active: return if report.failed: @@ -97,10 +97,10 @@ class StepwisePlugin: if report.nodeid == self.lastfailed: self.lastfailed = None - def pytest_report_collectionfinish(self): - if self.active and self.config.getoption("verbose") >= 0 and self.report_status: - return "stepwise: %s" % self.report_status - + def pytest_report_collectionfinish(self): + if self.active and self.config.getoption("verbose") >= 0 and self.report_status: + return "stepwise: %s" % self.report_status + def pytest_sessionfinish(self, session): if self.active: self.config.cache.set("cache/stepwise", self.lastfailed) |