Merge pull request #3912 from dhirensr/needless_message
Needless message printed with --failed-first and no failed tests #3853
This commit is contained in:
commit
64f00683f2
1
AUTHORS
1
AUTHORS
|
@ -47,6 +47,7 @@ Christian Theunert
|
|||
Christian Tismer
|
||||
Christopher Gilling
|
||||
Cyrus Maden
|
||||
Dhiren Serai
|
||||
Daniel Grana
|
||||
Daniel Hahler
|
||||
Daniel Nuri
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Removed ``"run all (no recorded failures)"`` message printed with ``--failed-first`` and ``--last-failed`` when there are no failed tests.
|
|
@ -134,10 +134,7 @@ 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:
|
||||
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(
|
||||
|
|
|
@ -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