[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public

Conversation

Copy link
Member

tirkarthi commented Jan 18, 2019

Add support for staticmethod and classmethod to mock created with autospec. Patch by @felipeochoa converted into a PR.

Co-authored-by: Felipe felipe.nospam.ochoa@gmail.com

https://bugs.python.org/issue23078

tirkarthi and others added 2 commits January 18, 2019 23:06
Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>
Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>
Copy link
Member Author

@mariocj89 @cjw296 Friendly ping. I have converted the patch from the tracker to PR attributing to original author. It was a frequently requested mock feature and I would be happy to act on review comments for this one.

Thanks.

Copy link
Contributor

mariocj89 left a comment

Choose a reason for hiding this comment

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

Great!, small nitpicks if you want to pick them.

#Issue23078
def test_create_autospec_staticmethod(self):
class TestClass:
method = staticmethod(lambda: None)
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be easier to read with the common syntax decorating the method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, changed to decorators 👍

@@ -0,0 +1,2 @@
Add support for staticmethod and classmethod with autospec. Based on patch
by Felipe.
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to include Felipe's surname. And you can also get credit for this :).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, made the changes. cc : @felipeochoa

Copy link
Contributor

mariocj89 left a comment

Choose a reason for hiding this comment

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

Great! 😄

Copy link
Contributor

Thanks @tirkarthi for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

Copy link
Contributor

Sorry, @tirkarthi and @berkerpeksag, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 9b21856b0fcda949de239edc7aa6cf3f2f4f77a3 3.7

berkerpeksag pushed a commit to berkerpeksag/cpython that referenced this pull request Apr 22, 2019
…ec() (pythonGH-11613)

Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>

(cherry picked from commit 9b21856)
Copy link

GH-12901 is a backport of this pull request to the 3.7 branch.

berkerpeksag added a commit that referenced this pull request Apr 22, 2019
…ec() (GH-11613)

Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>

(cherry picked from commit 9b21856)
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.

6 participants