T3853:removed needless message printed with --failed-first,--last-failed and no failed tests
This commit is contained in:
parent
a605ad4d11
commit
3035b2724d
1
AUTHORS
1
AUTHORS
|
@ -47,6 +47,7 @@ Christian Theunert
|
|||
Christian Tismer
|
||||
Christopher Gilling
|
||||
Cyrus Maden
|
||||
Dhiren Serai
|
||||
Daniel Grana
|
||||
Daniel Hahler
|
||||
Daniel Nuri
|
||||
|
|
|
@ -134,15 +134,12 @@ class LFPlugin(object):
|
|||
def pytest_report_collectionfinish(self):
|
||||
if self.active:
|
||||
if not self._previously_failed_count:
|
||||
mode = "run {} (no recorded failures)".format(
|
||||
self._no_failures_behavior
|
||||
)
|
||||
else:
|
||||
noun = "failure" if self._previously_failed_count == 1 else "failures"
|
||||
suffix = " first" if self.config.getoption("failedfirst") else ""
|
||||
mode = "rerun previous {count} {noun}{suffix}".format(
|
||||
count=self._previously_failed_count, suffix=suffix, noun=noun
|
||||
)
|
||||
return None
|
||||
noun = "failure" if self._previously_failed_count == 1 else "failures"
|
||||
suffix = " first" if self.config.getoption("failedfirst") else ""
|
||||
mode = "rerun previous {count} {noun}{suffix}".format(
|
||||
count=self._previously_failed_count, suffix=suffix, noun=noun
|
||||
)
|
||||
return "run-last-failure: %s" % mode
|
||||
|
||||
def pytest_runtest_logreport(self, report):
|
||||
|
|
|
@ -414,13 +414,7 @@ class TestLastFailed(object):
|
|||
)
|
||||
|
||||
result = testdir.runpytest(test_a, "--lf")
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"collected 2 items",
|
||||
"run-last-failure: run all (no recorded failures)",
|
||||
"*2 passed in*",
|
||||
]
|
||||
)
|
||||
result.stdout.fnmatch_lines(["collected 2 items", "*2 passed in*"])
|
||||
|
||||
result = testdir.runpytest(test_b, "--lf")
|
||||
result.stdout.fnmatch_lines(
|
||||
|
@ -617,6 +611,17 @@ class TestLastFailed(object):
|
|||
assert self.get_cached_last_failed(testdir) == []
|
||||
assert result.ret == 0
|
||||
|
||||
@pytest.mark.parametrize("quiet", [True, False])
|
||||
@pytest.mark.parametrize("opt", ["--ff", "--lf"])
|
||||
def test_lf_and_ff_prints_no_needless_message(self, quiet, opt, testdir):
|
||||
# Issue 3853
|
||||
testdir.makepyfile("def test(): pass")
|
||||
args = [opt]
|
||||
if quiet:
|
||||
args.append("-q")
|
||||
result = testdir.runpytest(*args)
|
||||
assert "run all" not in result.stdout.str()
|
||||
|
||||
def get_cached_last_failed(self, testdir):
|
||||
config = testdir.parseconfigure()
|
||||
return sorted(config.cache.get("cache/lastfailed", {}))
|
||||
|
|
Loading…
Reference in New Issue