Fix regression with --lf and non-selected failures
This commit is contained in:
parent
5c5966f62d
commit
bf3b26b3f7
|
@ -178,6 +178,7 @@ class LFPlugin(object):
|
||||||
"""
|
"""
|
||||||
if (
|
if (
|
||||||
self.active
|
self.active
|
||||||
|
and self._previously_failed_count
|
||||||
and self.config.getoption("lf")
|
and self.config.getoption("lf")
|
||||||
and path.isfile()
|
and path.isfile()
|
||||||
and self.lastfailed
|
and self.lastfailed
|
||||||
|
|
|
@ -832,6 +832,26 @@ class TestLastFailed(object):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_lastfailed_with_unknown_failure(self, testdir):
|
||||||
|
testdir.makepyfile(
|
||||||
|
**{
|
||||||
|
"pkg1/test_1.py": """def test_1(): assert 0""",
|
||||||
|
"pkg1/test_2.py": """def test_2(): pass""",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
result = testdir.runpytest()
|
||||||
|
result.stdout.fnmatch_lines(["collected 2 items", "* 1 failed, 1 passed in *"])
|
||||||
|
|
||||||
|
py.path.local("pkg1/test_1.py").remove()
|
||||||
|
result = testdir.runpytest("--lf")
|
||||||
|
result.stdout.fnmatch_lines(
|
||||||
|
[
|
||||||
|
"collected 1 item",
|
||||||
|
"run-last-failure: 1 known failures not in selected tests",
|
||||||
|
"* 1 passed in *",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestNewFirst(object):
|
class TestNewFirst(object):
|
||||||
def test_newfirst_usecase(self, testdir):
|
def test_newfirst_usecase(self, testdir):
|
||||||
|
|
Loading…
Reference in New Issue