[issue26750] Mock autospec does not work with subclasses of property()

2016-08-17 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
stage: commit review -> resolved

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

inspect.isdatadescriptor() is better indeed.
(I was initially working on an old version of mock.py which does not import 
inspect, and I did not want to add the dependency there).

- inspect uses hasattr(type(obj)) instead of hasatr(obj). This is better, (but 
does not work for 2.x old-style classes)

- my patch tested for __del__... this is completely wrong, it should have been 
__delete__. oops.
inspect.isdatadescriptor() does not test for __delete__. This is insaccurate, 
but I doubt it will ever matter. This is only possible for Python-defined 
descriptors, the C implementation always exposes both __set__ and __delete__ 
when tp_set is filled.

IOW, I'm happy with the current state.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ff02380b1bf by Gregory P. Smith in branch '3.5':
Issue #26750: use inspect.isdatadescriptor instead of our own
https://hg.python.org/cpython/rev/3ff02380b1bf

New changeset d51a66622266 by Gregory P. Smith in branch 'default':
Issue #26750: use inspect.isdatadescriptor instead of our own
https://hg.python.org/cpython/rev/d51a66622266

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Probably just Amaury and I forgetting that existed.  Amaury, 
inspect.isdatadescriptor's implementation is a bit different than this change's 
_is_data_descriptor.  Thoughts?

--
stage: resolved -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-07 Thread Berker Peksag

Berker Peksag added the comment:

Thanks! Is there a reason not to use inspect.isdatadescriptor() instead of 
_is_data_descriptor()?

--
stage: commit review -> resolved

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-07 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e947248100ae by Gregory P. Smith in branch '3.5':
Issue #26750: unittest.mock.create_autospec() now works properly
https://hg.python.org/cpython/rev/e947248100ae

New changeset 0bc14c91ef7e by Gregory P. Smith in branch 'default':
Issue #26750: unittest.mock.create_autospec() now works properly for
https://hg.python.org/cpython/rev/0bc14c91ef7e

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-07 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-05-18 Thread Berker Peksag

Changes by Berker Peksag :


--
assignee:  -> berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-05-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Updated patch with review comments.

--
Added file: http://bugs.python.org/file42891/mock-descriptor-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-04-21 Thread Berker Peksag

Changes by Berker Peksag :


--
components: +Library (Lib) -Tests
nosy: +berker.peksag
stage:  -> patch review
type: enhancement -> behavior
versions: +Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26750] Mock autospec does not work with subclasses of property()

2016-04-13 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

When patching a class, mock.create_autospec() correctly detects properties and 
__slot__ attributes, but not subclasses of property() or other kinds of data 
descriptors.

The attached patch detects all data descriptors and patch them the way they 
should be.

--
components: Tests
files: mock-descriptor.patch
keywords: patch
messages: 263361
nosy: amaury.forgeotdarc, michael.foord
priority: normal
severity: normal
status: open
title: Mock autospec does not work with subclasses of property()
type: enhancement
Added file: http://bugs.python.org/file42458/mock-descriptor.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com