[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-04-21 Thread Berker Peksag
Berker Peksag added the comment: Thank you! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-04-21 Thread Berker Peksag
Berker Peksag added the comment: New changeset 15a57a3cadb992bb1752302333ff593e7eab284c by Berker Peksag in branch '3.7': bpo-23078: Add support for {class,static}method to mock.create_autospec() (GH-11613) https://github.com/python/cpython/commit/15a57a3cadb992bb1752302333ff593e7eab284c -

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-04-21 Thread Berker Peksag
Change by Berker Peksag : -- pull_requests: +12829 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-04-21 Thread Berker Peksag
Change by Berker Peksag : -- pull_requests: -11349 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-04-21 Thread Berker Peksag
Berker Peksag added the comment: New changeset 9b21856b0fcda949de239edc7aa6cf3f2f4f77a3 by Berker Peksag (Xtreak) in branch 'master': bpo-23078: Add support for {class,static}method to mock.create_autospec() (GH-11613) https://github.com/python/cpython/commit/9b21856b0fcda949de239edc7aa6cf3

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- pull_requests: +11348, 11349, 11350 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- pull_requests: +11348, 11349 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- pull_requests: +11348 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-17 Thread Felipe
Felipe added the comment: Please go ahead with the PR. I can't push this one through, but would be great to have this finally land! On Thu, 17 Jan 2019 at 03:42, Karthikeyan Singaravelan < rep...@bugs.python.org> wrote: > > Karthikeyan Singaravelan added the comment: > > @berker.peksag I hav

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-17 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: @berker.peksag I have converted the patch at https://bugs.python.org/file40470/issue23078.patch and pushed it to a GitHub branch https://github.com/python/cpython/compare/master...tirkarthi:bpo23078 . I am willing to open a PR attributing to @fov i

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-15 Thread John Parejko
John Parejko added the comment: Were you able to make any progress on this? Do you need any help? -- nosy: +parejkoj-3 ___ Python tracker ___ _

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-12-09 Thread Andrew Tennikoff
Change by Andrew Tennikoff : -- nosy: +atenni ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-11-27 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the pings. I will work on this issue this weekend. Note that 3.4 and 3.5 are in security-fix-only mode now, so I removed them from the versions field. -- assignee: -> berker.peksag versions: -Python 3.4, Python 3.5 __

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-11-27 Thread John Parejko
John Parejko added the comment: Adding to the list of "I just ran into this". The patch submitted by fov seems straightforward enough: what can we do to help shepherd it along? -- nosy: +John Parejko2 ___ Python tracker

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-11-26 Thread Tom Dalton
Tom Dalton added the comment: Here's a minimal example so my comment is not totally vacuous: ``` import unittest from unittest import mock class Foo: @classmethod def bar(cls, baz): pass class TestFoo(unittest.TestCase): def test_bar(self): with unittest.mock.patch

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-11-26 Thread Tom Dalton
Tom Dalton added the comment: I've just come across this too, so would be great if the patch can be progressed. -- nosy: +tom.dalton.fanduel ___ Python tracker ___ __

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-08-01 Thread Kamil Gałuszka
Kamil Gałuszka added the comment: This affects all versions from 3.4 up to 3.8-dev. Would be nice if someone could do the review of the supplied patch. Thanks for awesome work on Python! I'm here because it just hit me also and I was for 1 h thinking that I don't know how to use patch/mock.

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2018-01-25 Thread Dean Liao
Dean Liao added the comment: I planned to upgrade Chromium OS's mock module to 2.0.0. I also encountered the issue that classmethod cannot be patched as callable mock. Reviewers, can we start the review process? -- nosy: +deanliao ___ Python tracke

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2017-11-08 Thread Germano
Germano added the comment: Hi, I hit this problem wile mocking one static method and found this fix. Tested it and works for me. However, I did not find it pushed anywhere: no Python 3.x and no mock for 2.7. Is there any reason why it is not pushed anywhere, yet? -- nosy: +germanop _

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2016-02-10 Thread Erik Purins
Changes by Erik Purins : -- nosy: +epu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-09-14 Thread Felipe
Felipe added the comment: The attached patch implements these changes through _callable instead. This patch also ensures that the underlying object that staticmethod and classmethod wrap is a callable object as well. -- Added file: http://bugs.python.org/file40470/issue23078.patch ___

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-08-18 Thread Stephen Shirley
Changes by Stephen Shirley : -- nosy: +kormat ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-06-02 Thread Felipe
Felipe added the comment: Regarding Claudiu's comment about `staticmethod(x)` or `classmethod(x)` not being callable, would it suffice to add a specific check of the form `(isinstance(x, (classmethod, staticmethod)) and _callable(x.__func__))`? Separately, would it be better to include the che

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-04-14 Thread Kasia Jachim
Changes by Kasia Jachim : -- nosy: +lukasz.langa ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-01-22 Thread Claudiu Popa
Changes by Claudiu Popa : Added file: http://bugs.python.org/file37823/issue23078.patch ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-01-22 Thread Claudiu Popa
Claudiu Popa added the comment: Ups, sorry about that, I'll update the patch. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-01-22 Thread Berker Peksag
Berker Peksag added the comment: Looks like b6ea3dc89a78 is not a valid changeset. Could you attach a patch from the Mercurial repo? -- nosy: +berker.peksag versions: -Python 2.7 ___ Python tracker __

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2015-01-22 Thread Claudiu Popa
Claudiu Popa added the comment: Here's a patch which does this. One problem could be that staticmethod(some_callable) or classmethod(some_callable) aren't callable per se, but given the fact that users expects Foo.staticmethod or Foo.klassmethod to be callable when patching them, it's somethin

[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2014-12-18 Thread Kevin Benton
New submission from Kevin Benton: If one of the mock.patch methods is used with autospec=True on a staticmethod in an object, the mock library determines that it is not callable by checking for the __call__ attribute. This results in a NonCallableMagicMock being returned which of course dies w