mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)
Patcher's __exit__() is now never called if its __enter__() is failed. Returning true from __exit__() silences now the exception.
This commit is contained in:
parent
cd8295ff75
commit
4b222c9491
3 changed files with 29 additions and 48 deletions
|
@ -774,7 +774,7 @@ class PatchTest(unittest.TestCase):
|
|||
d = {'foo': 'bar'}
|
||||
original = d.copy()
|
||||
patcher = patch.dict(d, [('spam', 'eggs')], clear=True)
|
||||
self.assertEqual(patcher.stop(), False)
|
||||
self.assertFalse(patcher.stop())
|
||||
self.assertEqual(d, original)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue