Author cjw296
Recipients cjw296, michael.foord, ncoghlan, yselivanov
Date 2015-11-01.23:54:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A naive solution is to chat unittest.mock._Call's __getattr__ to be as follows:

def __getattr__(self, attr):
    if attr == '__wrapped__':
        raise AttributeError('__wrapped__')
    if is None:
        return _Call(name=attr, from_kall=False)
    name = '%s.%s' % (, attr)
    return _Call(name=name, parent=self, from_kall=False)

...but I'm not sure that's the right thing to do.

inspect.unwrap is trying to catch this loop, but the implementation fails for cases where f.__wrapped__ is generative, as in the case of Mock and _Call.

I suspect both modules need a fix, but not sure what best to suggest.
Date User Action Args
2015-11-01 23:54:21cjw296setrecipients: + cjw296, ncoghlan, michael.foord, yselivanov
2015-11-01 23:54:21cjw296setmessageid: <>
2015-11-01 23:54:21cjw296linkissue25532 messages
2015-11-01 23:54:21cjw296create