Skip to content

Commit bbf9e87

Browse files
committed
Fix testpatch.PatchTest.test_exit_idempotent
.stop() and __exit__ have subtly different code paths, so to really test __exit__ idempotency, we need to call it specifically twice.
1 parent 15415cc commit bbf9e87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_unittest/testmock/testpatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def test_stop_idempotent(self):
748748
def test_exit_idempotent(self):
749749
patcher = patch(foo_name, 'bar', 3)
750750
with patcher:
751-
patcher.stop()
751+
patcher.__exit__(None, None, None)
752752

753753

754754
def test_second_start_failure(self):

0 commit comments

Comments
 (0)