diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2008-07-01 14:25:44 -0300 |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2008-07-01 14:25:44 -0300 |
commit | 9aef58ec39a9395d7427aa3b938e96b9d021467a (patch) | |
tree | eeae1766024095aba05fafc498d412d8b7372fb7 | |
parent | a2a848a3c15915639e33241a4016846a9e082906 (diff) | |
parent | 77375c5cf3c1f47006322c7c693a3fda9ac383d6 (diff) | |
download | mocker-9aef58ec39a9395d7427aa3b938e96b9d021467a.tar.gz |
Merging branch from Thomas which changes Mocker.patch() to use the
patcher when setting __mocker_mock__, rather than setting it in a
persistent way.
-rw-r--r-- | mocker.py | 2 | ||||
-rwxr-xr-x | test.py | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -670,7 +670,7 @@ class MockerBase(object): event.add_task(patcher) mock = Mock(self, object=object, patcher=patcher, passthrough=True, spec=spec) - object.__mocker_mock__ = mock + patcher.patch_attr(object, '__mocker_mock__', mock) return mock def act(self, path): @@ -3947,6 +3947,8 @@ class PatcherTest(TestCase): self.mocker.replay() self.assertEquals(self.C().method(), "mocked") self.assertRaises(AssertionError, self.C().method) + self.mocker.restore() + self.assertEquals(getattr(self.C, "__mocker_mock__", None), None) def test_recorder_instance_getattr(self): self.C.attr = "original" |