diff options
author | Michael Foord <michael@voidspace.org.uk> | 2011-09-26 00:20:00 +0100 |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2011-09-26 00:20:00 +0100 |
commit | b1d0aeee358e950806b6b81a982136f91bda12dc (patch) | |
tree | 07fbcfcaf8e91f24f6cbd2c999d07987117dcb0d /mock.py | |
parent | 0e488c7d7304f6d835b4707d4ab805ca43e97d79 (diff) | |
download | mock-b1d0aeee358e950806b6b81a982136f91bda12dc.tar.gz |
Calls to mocks attached as magic methods are recorded in mock calls
Diffstat (limited to 'mock.py')
-rw-r--r-- | mock.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -765,6 +765,9 @@ class NonCallableMock(Base): real = lambda *args, **kw: original(self, *args, **kw) value = mocksignature(value, real, skipfirst=True) else: + # only set _new_name and not name so that mock_calls is tracked + # but not method calls + _check_and_set_parent(self, value, None, name) setattr(type(self), name, value) elif name in _allowed_names: pass @@ -781,6 +784,10 @@ class NonCallableMock(Base): # for magic methods that are still MagicProxy objects and # not set on the instance itself return + elif name in self._mock_children: + del self._mock_children[name] + return + return object.__delattr__(self, name) |