Skip to content

Commit 1acc0e3

Browse files
committed
Use backward-compatibility-only mock fixture to ensure complete coverage
1 parent 8c92792 commit 1acc0e3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test_pytest_mock.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,13 @@ def test_foo(mock, tmpdir):
111111
''')
112112
result = testdir.runpytest('-s')
113113
result.stderr.fnmatch_lines(['*"mock" fixture has been deprecated*'])
114+
115+
116+
def test_deprecated_mock(mock, tmpdir):
117+
"""
118+
Use backward-compatibility-only mock fixture to ensure complete coverage.
119+
"""
120+
mock.patch('os.listdir', return_value=['mocked'])
121+
assert os.listdir(str(tmpdir)) == ['mocked']
122+
mock.stopall()
123+
assert os.listdir(str(tmpdir)) == []

0 commit comments

Comments
 (0)