[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-12 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-12 Thread miss-islington
Change by miss-islington : -- pull_requests: +10358 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Chris Withers
Chris Withers added the comment: Ah, yeah, I can see the blanket patch and a more local patch in a monorepo being a thing, cool, let's have a look! -- ___ Python tracker ___

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Anthony Sottile
Anthony Sottile added the comment: to be honest, I don't recall exactly given it's been 2 and a half years since the original report with no activity. if I recall correctly, this was encountered while upgrading the `mock` backport in yelp's monolithic repository. I want to say the reason

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Chris Withers
Chris Withers added the comment: Before we get too far: what's the use case for this double patching? -- ___ Python tracker ___

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Anthony Sottile
Anthony Sottile added the comment: I've opened a PR with the test included: https://github.com/python/cpython/pull/11085 -- ___ Python tracker ___

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +10317 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks @asottile for the patch. I think the original AttributeError is resolved with issue28919 where they were silenced. It seems similar to issue32153 though the exception occurs from mock instead of partial object as in issue32153. The fix was

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-05-01 Thread Anthony Sottile
Anthony Sottile added the comment: Seems I've named the patchfile incorrectly -- Hopefully this is correct this time? -- keywords: +patch nosy: +Anthony Sottile Added file: http://bugs.python.org/file42675/2.patch ___ Python tracker

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-07 Thread SilentGhost
Changes by SilentGhost : -- nosy: +michael.foord stage: -> patch review type: crash -> behavior versions: -Python 3.4 ___ Python tracker

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: Here's an improved patch which: - passes the tests - puts the test in the correct place I'm not entirely happy with the approach -- open to suggestions :) -- Added file: http://bugs.python.org/file42387/patch2 ___

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: The root cause seems to be that autospecced functions return a function object (not a Mock instance) which a '.mock' attribute which is a MagicMock ( assigned here:

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
New submission from Anthony Sottile: Originally from https://github.com/testing-cabal/mock/issues/350 ## Example ```python from unittest import mock class C(object): def f(self): pass c = C() with mock.patch.object(c, 'f', autospec=True): with mock.patch.object(c, 'f',