From 47587fc40380290700dd6f182c255397cd17e75f Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Tue, 4 Dec 2007 22:50:33 -0200 Subject: In MockerTestCase's constructor, copy attributes from the original method into the wrapper. --- mocker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mocker.py') diff --git a/mocker.py b/mocker.py index 1a10dda..8929b91 100644 --- a/mocker.py +++ b/mocker.py @@ -107,7 +107,12 @@ class MockerTestCase(unittest.TestCase): self.__cleanup() self.mocker.restore() self.mocker.verify() - test_method_wrapper.__doc__ = test_method.__doc__ + # Copy all attributes from the original method.. + for attr in dir(test_method): + # .. unless they're present in our wrapper already. + if not hasattr(test_method_wrapper, attr) or attr == "__doc__": + setattr(test_method_wrapper, attr, + getattr(test_method, attr)) setattr(self, methodName, test_method_wrapper) self.mocker = Mocker() -- cgit v1.2.1