Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-21600: Fix `mock.patch.dict` to be stopped with `mock.patch.stopall` #17606

Open
wants to merge 1 commit into
base: master
from

Conversation

@mariocj89
Copy link
Contributor

mariocj89 commented Dec 14, 2019

As the function was not registering in the active patches, the mocks
started by mock.patch.dict were not being stopped when
mock.patch.stopall was being called.

https://bugs.python.org/issue21600

Copy link
Contributor

tirkarthi left a comment

Either we can have self._active_patches to add to stopall to stop patches with patch.dict or add to already active patches.

Lib/unittest/mock.py Outdated Show resolved Hide resolved
@mariocj89 mariocj89 force-pushed the mariocj89:pu/stopall branch from 6b5de36 to 25dd2e1 Dec 14, 2019
As the function was not registering in the active patches, the mocks
started by `mock.patch.dict` were not being stopped when
`mock.patch.stopall` was being called.
@mariocj89 mariocj89 force-pushed the mariocj89:pu/stopall branch from 25dd2e1 to 5bf4f69 Dec 14, 2019
Copy link
Contributor

tirkarthi left a comment

LGTM. Thanks Mario :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.