From 2256f2f04d9d073ca1c3e53deb6e6d6d6966c68d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 31 Aug 2018 08:01:55 -0300 Subject: [PATCH] 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 --- testing/test_cacheprovider.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index 86bd65810..23ec73599 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -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", {}))