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:
parent
11e591e442
commit
2256f2f04d
|
@ -553,19 +553,6 @@ class TestLastFailed(object):
|
||||||
testdir.runpytest("-q", "--lf")
|
testdir.runpytest("-q", "--lf")
|
||||||
assert os.path.exists(".pytest_cache/v/cache/lastfailed")
|
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):
|
def test_xfail_not_considered_failure(self, testdir):
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
|
@ -628,13 +615,19 @@ class TestLastFailed(object):
|
||||||
@pytest.mark.parametrize("opt", ["--ff", "--lf"])
|
@pytest.mark.parametrize("opt", ["--ff", "--lf"])
|
||||||
def test_lf_and_ff_prints_no_needless_message(self, quiet, opt, testdir):
|
def test_lf_and_ff_prints_no_needless_message(self, quiet, opt, testdir):
|
||||||
# Issue 3853
|
# Issue 3853
|
||||||
testdir.makepyfile("def test(): pass")
|
testdir.makepyfile("def test(): assert 0")
|
||||||
args = [opt]
|
args = [opt]
|
||||||
if quiet:
|
if quiet:
|
||||||
args.append("-q")
|
args.append("-q")
|
||||||
result = testdir.runpytest(*args)
|
result = testdir.runpytest(*args)
|
||||||
assert "run all" not in result.stdout.str()
|
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):
|
def get_cached_last_failed(self, testdir):
|
||||||
config = testdir.parseconfigure()
|
config = testdir.parseconfigure()
|
||||||
return sorted(config.cache.get("cache/lastfailed", {}))
|
return sorted(config.cache.get("cache/lastfailed", {}))
|
||||||
|
|
Loading…
Reference in New Issue