bpo-36366: Return None on stopping unstarted patch object (GH-12472)

Return None after calling unittest.mock.patch.object.stop() regardless of whether the object was started. This makes the method idempotent.


https://bugs.python.org/issue36366
This commit is contained in:
Xtreak 2019-03-29 02:38:43 +05:30 committed by Miss Islington (bot)
parent 3d78c4a6e5
commit 02b84cb1b4
3 changed files with 15 additions and 3 deletions

View file

@ -0,0 +1,4 @@
Calling ``stop()`` on an unstarted or stopped :func:`unittest.mock.patch`
object will now return `None` instead of raising :exc:`RuntimeError`,
making the method idempotent.
Patch byKarthikeyan Singaravelan.