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

Merged
merged 1 commit into from Jan 24, 2020

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
Member

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
Member

tirkarthi left a comment

LGTM. Thanks Mario :)

@cjw296 cjw296 merged commit e131c97 into python:master Jan 24, 2020
4 checks passed
4 checks passed
Azure Pipelines PR #20191214.17 succeeded
Details
bedevere/issue-number Issue number 21600 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 24, 2020

@cjw296: Please replace # with GH- in the commit message next time. Thanks!

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