[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-12 Thread Chris Withers
Chris Withers added the comment: Yep! Good catch :-) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-12 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: @cjw296 since the unit tests were added and the original report is fixed with 3.7 and above can this be closed? -- ___ Python tracker

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-03 Thread Chris Withers
Chris Withers added the comment: New changeset 1ef06c62d3c05cbba6448c56af30a09c551c9ec2 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-32153: Add unit test for create_autospec with partial function returned in getattr (GH-10398) (#10855)

[issue32153] mock.create_autospec fails if an attribute is a partial function

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

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-02 Thread Chris Withers
Chris Withers added the comment: New changeset c667b094ae37799a7e42ba5cd2ad501cc7920888 by Chris Withers (Xtreak) in branch 'master': bpo-32153: Add unit test for create_autospec with partial function returned in getattr (#10398)

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-11-07 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: @berker.peksag I have created a unit test PR and verified that the test fails in 3.6 and passes on master. # 3.6 branch cpython git:(25bd107399) ./python.exe Python 3.6.7+ (remotes/upstream/3.6:25bd107399, Nov 8 2018, 00:50:43) [GCC 4.2.1

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-11-07 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +9683 stage: needs patch -> patch review ___ Python tracker ___

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-10-11 Thread Berker Peksag
Berker Peksag added the comment: Yes, it would be great if we could convert the snippet in msg307115 to a test case before closing this issue. 3.6 still has this bug, but since we are pretty close to the end of its bugfix maintenance period, we can skip it. -- versions: -Python 3.6

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-10-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I think the original error has been fixed with issue28919 where the attribute errors are ignored while copying the functions as suggested by Anthony in solution 2. So can this issue be closed as outdated to reopen a new one for using

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-16 Thread Anthony Flury
Anthony Flury added the comment: Am not a big fan of special casing, I think the functools.update_wrapper is the way to go - will have a look later and produce a pull request with some test cases. -- ___ Python tracker

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Berker Peksag
Berker Peksag added the comment: Or we can special case functools.partial() in _copy_func_details() and use partial_object.func.__name__. (I'm not sure which solution is better, but we need to the same thing for __doc__ as well.) -- ___ Python

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Berker Peksag
Berker Peksag added the comment: I think option 2 is what functools.update_wrapper() does and it may be better to make create_autospec() consistent with it. Perhaps we can replace _copy_func_details() with functools.update_wrapper(): assigments = ( '__name__', '__doc__',

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Anthony Flury
Anthony Flury added the comment: It seems to me that we have three alternatives : 1. Refuse to create the mock object with a suitable Exception (rather than a crash 2. Copy the object and simply ignore the missing dunder_name (so that funcopy dunder_name is not set 3. Set funcopy

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-14 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32153] mock.create_autospec fails if an attribute is a partial function

2017-11-28 Thread Claudiu Belu
Change by Claudiu Belu : -- versions: -Python 3.8 ___ Python tracker ___ ___

[issue32153] mock.create_autospec fails if an attribute is a partial function

2017-11-28 Thread Claudiu Belu
New submission from Claudiu Belu : If an object's attribute is a partial function, mock.create_autospec will fail while trying to copy the partial functions' details to the mocked function, as the partial function does not have the __name__ attribute. Example: