Remove test which is no longer required and improve test_lf_and_ff_prints_no_needless_message

* test_lf_and_ff_obey_verbosity is no longer necessary because
  test_lf_and_ff_prints_no_needless_message already checks if the proper messages
  are displayed when -q is used.

* Improve test_lf_and_ff_prints_no_needless_message so we also check that
  the correct message is displayed when there are failures to run
This commit is contained in:
Bruno Oliveira 2018-08-31 08:01:55 -03:00
parent 11e591e442
commit 2256f2f04d
1 changed files with 7 additions and 14 deletions

View File

@ -553,19 +553,6 @@ class TestLastFailed(object):
testdir.runpytest("-q", "--lf")
assert os.path.exists(".pytest_cache/v/cache/lastfailed")
@pytest.mark.parametrize("quiet", [True, False])
@pytest.mark.parametrize("opt", ["--ff", "--lf"])
def test_lf_and_ff_obey_verbosity(self, quiet, opt, testdir):
testdir.makepyfile("def test(): pass")
args = [opt]
if quiet:
args.append("-q")
result = testdir.runpytest(*args)
if quiet:
assert "run all" not in result.stdout.str()
else:
assert "run all" in result.stdout.str()
def test_xfail_not_considered_failure(self, testdir):
testdir.makepyfile(
"""
@ -628,13 +615,19 @@ class TestLastFailed(object):
@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")
testdir.makepyfile("def test(): assert 0")
args = [opt]
if quiet:
args.append("-q")
result = testdir.runpytest(*args)
assert "run all" not in result.stdout.str()
result = testdir.runpytest(*args)
if quiet:
assert "run all" not in result.stdout.str()
else:
assert "rerun previous" in result.stdout.str()
def get_cached_last_failed(self, testdir):
config = testdir.parseconfigure()
return sorted(config.cache.get("cache/lastfailed", {}))