Skip to content

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

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

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

mariocj89
Copy link
Contributor

@mariocj89 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 tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.
Copy link
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks Mario :)

@cjw296 cjw296 merged commit e131c97 into python:master Jan 24, 2020
@bedevere-bot
Copy link

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

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
…#17606)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants