Skip to content

Commit fb564bf

Browse files
committed
Merge pull request #3 from nicoddemus/issue-2
un-patching correctly when patching objects twice
2 parents cbd3118 + fa2cd78 commit fb564bf

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pytest_mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def stopall(self):
2424
Stop all patchers started by this fixture. Can be safely called multiple
2525
times.
2626
"""
27-
for p in self._patches:
27+
for p in reversed(self._patches):
2828
p.stop()
2929
self._patches[:] = []
3030

test_pytest_mock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def test_mock_patches(mock_fs, mock, check_unix_fs_mocked):
7474
mock functionality. We parametrize different mock methods to ensure
7575
all (intended, at least) mock API is covered.
7676
"""
77+
mock_fs(mock)
7778
mocked_rm, mocked_ls = mock_fs(mock)
7879
check_unix_fs_mocked(mocked_rm, mocked_ls)
7980

0 commit comments

Comments
 (0)