Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-31177: Skip deleted attributes while calling reset_mock #9302
Conversation
@@ -0,0 +1 @@ | |||
Skip deleted attributes while calling :meth:`mock.reset_mock`. |
This comment has been minimized.
This comment has been minimized.
mariocj89
Oct 26, 2018
Contributor
I'd suggest rewording this to something around:
"Fix bug that prevented using reset_mock
on mock instances with deleted attributes"
This comment has been minimized.
This comment has been minimized.
Thanks @mariocj89 for the review. I have made the suggested changes. |
Great! Thanks a lot :) @vstinner, this seems to fix a bug in unittest.mock. When attributes are deleted in a mock they are marked with a mock.sentinel to prevent automatically creating other mocks dynamically, this is done by adding the _deleted sentinel to the child mocks dictionary. |
This comment has been minimized.
This comment has been minimized.
LGTM. |
This comment has been minimized.
This comment has been minimized.
Please see #10807 that proposes deleted attributes to be retained that is different from my PR's behavior. |
This comment has been minimized.
This comment has been minimized.
Oops, I had a draft comment that I forgot to send! |
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Dec 1, 2018
Thanks @tirkarthi for the PR, and @vstinner for merging it |
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Dec 1, 2018
Thanks @tirkarthi for the PR, and @vstinner for merging it |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Dec 1, 2018
GH-10842 is a backport of this pull request to the 3.6 branch. |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Dec 1, 2018
GH-10843 is a backport of this pull request to the 3.7 branch. |
This comment has been minimized.
This comment has been minimized.
Thanks for the fix!
|
tirkarthi commentedSep 14, 2018
•
edited by bedevere-bot
Skip the deleted attributes while calling
reset_mock
so that it doesn't cause anAttributeError
.Thanks
https://bugs.python.org/issue31177