diff options
author | Brian Maissy <brian.maissy@gmail.com> | 2018-03-10 22:45:45 +0200 |
---|---|---|
committer | Brian Maissy <brian.maissy@gmail.com> | 2018-03-10 22:45:45 +0200 |
commit | d2e533b8a3636f29d8999b90fed1072ac4b5ee1b (patch) | |
tree | 18017950abae081f9817ea3ac077318e5fb7dd97 /testing/test_cacheprovider.py | |
parent | d6ddeb395bbf788a708c90f6e3003fb57cdc3b7e (diff) | |
download | pytest-d2e533b8a3636f29d8999b90fed1072ac4b5ee1b.tar.gz |
implemented --last-failed-no-failures
Diffstat (limited to 'testing/test_cacheprovider.py')
-rw-r--r-- | testing/test_cacheprovider.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/test_cacheprovider.py b/testing/test_cacheprovider.py index 4fb08862a..51e45dd48 100644 --- a/testing/test_cacheprovider.py +++ b/testing/test_cacheprovider.py @@ -604,6 +604,36 @@ class TestLastFailed(object): result.stdout.fnmatch_lines('*4 passed*') assert self.get_cached_last_failed(testdir) == [] + def test_lastfailed_no_failures_behavior_all_passed(self, testdir): + testdir.makepyfile(""" + def test_1(): + assert True + def test_2(): + assert True + """) + result = testdir.runpytest() + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf") + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf", "--lfnf", "all") + result.stdout.fnmatch_lines(["*2 passed*"]) + result = testdir.runpytest("--lf", "--lfnf", "none") + result.stdout.fnmatch_lines(["*2 desel*"]) + + def test_lastfailed_no_failures_behavior_empty_cache(self, testdir): + testdir.makepyfile(""" + def test_1(): + assert True + def test_2(): + assert False + """) + result = testdir.runpytest("--lf", "--cache-clear") + result.stdout.fnmatch_lines(["*1 failed*1 passed*"]) + result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "all") + result.stdout.fnmatch_lines(["*1 failed*1 passed*"]) + result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "none") + result.stdout.fnmatch_lines(["*2 desel*"]) + class TestNewFirst(object): def test_newfirst_usecase(self, testdir): |