Improve --lf/--ff test as commented during review

This commit is contained in:
Bruno Oliveira 2017-04-11 17:55:55 -03:00
parent 08d83a5c6a
commit 1125786e78
1 changed files with 11 additions and 8 deletions

View File

@ -200,14 +200,16 @@ class TestLastFailed(object):
]) ])
def test_lastfailed_failedfirst_order(self, testdir): def test_lastfailed_failedfirst_order(self, testdir):
testdir.tmpdir.join('test_a.py').write(_pytest._code.Source(""" testdir.makepyfile(**{
def test_always_passes(): 'test_a.py': """
assert 1 def test_always_passes():
""")) assert 1
testdir.tmpdir.join('test_b.py').write(_pytest._code.Source(""" """,
def test_always_fails(): 'test_b.py': """
assert 0 def test_always_fails():
""")) assert 0
""",
})
result = testdir.runpytest() result = testdir.runpytest()
# Test order will be collection order; alphabetical # Test order will be collection order; alphabetical
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
@ -219,6 +221,7 @@ class TestLastFailed(object):
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"test_b.py*", "test_b.py*",
]) ])
assert 'test_a.py' not in result.stdout.str()
def test_lastfailed_difference_invocations(self, testdir, monkeypatch): def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)