[Python-Dev] [Python-checkins] cpython: PEP 417: Adding unittest.mock (original) (raw)

Terry Reedy tjreedy at udel.edu
Wed Mar 14 21:46:29 CET 2012


On 3/14/2012 4:22 PM, Michael Foord wrote:

On 14 Mar 2012, at 13:08, Terry Reedy wrote:

On 3/14/2012 3:25 PM, michael.foord wrote: +# mock.py +# Test tools for mocking and patching.

Should there be a note here about restrictions on editing this file? I notice that there are things like

+class OldStyleClass: + pass +ClassType = type(OldStyleClass) which are only present for running under Py2 and which would normally be removed for Py3. Yeah, I removed as much of the Python 2 compatibility code and thought I'd got it all. Thanks for pointing it out.

2000 lines is a lot to check through.

I'm maintaining a "clean" (no Python 2 compatibility code) version in the standard library.

Great. Here is something else, which is why I thought otherwise ;-).

+def _instance_callable(obj):

old style classes

If you want to leave the code as is, remove or revise the comment.

I'll be maintaining mock, so I'd like to be assigned any issues on it and at least talked to before changes are made. I am maintaining a backport still, but the Python standard library version is the canonical version.

Add unittest.mock to devguide/experts.rst and yourself with * appended.


Searching for 'old', I also found

+def _must_skip(spec, entry, is_type):

  •    # can't use type because of old style classes
  •    # old style class: can't have descriptors anyway

In testcallable.py

  •        for Klass in CallableX, Sub, Multi, OldStyle, OldStyleSub:

This is the last.

-- Terry Jan Reedy



More information about the Python-Dev mailing list