diff options
author | Thomas Hervé <thomas@canonical.com> | 2008-06-30 17:38:09 +0200 |
---|---|---|
committer | Thomas Hervé <thomas@canonical.com> | 2008-06-30 17:38:09 +0200 |
commit | 77375c5cf3c1f47006322c7c693a3fda9ac383d6 (patch) | |
tree | cddad95ec8224ad6e09a89de32911a057921347c | |
parent | 87e6cf304120f11ff7f163f1a98291682c34b988 (diff) | |
download | mocker-77375c5cf3c1f47006322c7c693a3fda9ac383d6.tar.gz |
Use the version that passes the landscape tests. Add a test for one of the fix.
-rw-r--r-- | mocker.py | 3 | ||||
-rwxr-xr-x | test.py | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -114,6 +114,7 @@ class MockerTestCase(unittest.TestCase): return result result.addCallback(verify) else: + self.mocker.reset() self.mocker.verify() return result # Copy all attributes from the original method.. @@ -669,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): @@ -3920,6 +3920,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" |