-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029)" #19734
Conversation
…ds in MagicMock (python#16029)" This reverts commit 72b1004.
obj = klass() | ||
self.assertEqual(obj.__getitem__(2), 2) | ||
self.assertEqual(obj.__custom_method__(), "foo") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about leaving these tests in, but change their expectations and add comments as to why things are the way they are and how they would be in a perfect world?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually reversions do a git revert of commit fixing conflicts and add a NEWS entry as needed if the change was released. I guess these can be added back as part of a separate tests only PR. I am new to doing a reversion so feel free to correct me if I am wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If cpython hadn't chose squashing commits as their appoach, I'd suggest doing the revert in one commit and then add the tests back in another commit.
However, given that squashing is the choice cpython has made, it makes little difference.
Maybe two commits in this PR which will get squashed down to one on merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have added back the test and added some comments referencing the issue.
@@ -0,0 +1,2 @@ | |||
Revert bpo-25597. :class:`unittest.mock.MagicMock` with wraps' set uses | |||
default return values for magic methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need this if the new item is removed above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change was published as part of an alpha release. So my belief with respect to reversion after a release is that someone might depend on it and to explicitly note tbe reversion as a NEWS entry from past reversions I looked in git log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but perhaps that means the original news item should stay too? It's a little confusing to have a reference to a bpo that isn't anywhere else in the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, added it back. Each alpha has a separate section and it reads like added in alpha 4 to be reverted by alpha 6. If anyone has concern or feedback later I will change it.
|
This reverts commit 72b1004.
https://bugs.python.org/issue39966