Skip to content

Commit

Permalink
Improve --lf/--ff test as commented during review
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Apr 11, 2017
1 parent 08d83a5 commit 1125786
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions testing/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,16 @@ def test_always_fails():
])

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

def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
Expand Down

0 comments on commit 1125786

Please sign in to comment.