Skip to content

Commit 1125786

Browse files
committed
Improve --lf/--ff test as commented during review
1 parent 08d83a5 commit 1125786

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

testing/test_cache.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,16 @@ def test_always_fails():
200200
])
201201

202202
def test_lastfailed_failedfirst_order(self, testdir):
203-
testdir.tmpdir.join('test_a.py').write(_pytest._code.Source("""
204-
def test_always_passes():
205-
assert 1
206-
"""))
207-
testdir.tmpdir.join('test_b.py').write(_pytest._code.Source("""
208-
def test_always_fails():
209-
assert 0
210-
"""))
203+
testdir.makepyfile(**{
204+
'test_a.py': """
205+
def test_always_passes():
206+
assert 1
207+
""",
208+
'test_b.py': """
209+
def test_always_fails():
210+
assert 0
211+
""",
212+
})
211213
result = testdir.runpytest()
212214
# Test order will be collection order; alphabetical
213215
result.stdout.fnmatch_lines([
@@ -219,6 +221,7 @@ def test_always_fails():
219221
result.stdout.fnmatch_lines([
220222
"test_b.py*",
221223
])
224+
assert 'test_a.py' not in result.stdout.str()
222225

223226
def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
224227
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)

0 commit comments

Comments
 (0)