summaryrefslogtreecommitdiff
path: root/mocker.py
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2010-06-20 15:04:54 -0300
committerGustavo Niemeyer <gustavo@niemeyer.net>2010-06-20 15:04:54 -0300
commit3a4c487d0d08f51dca83e31f35aae5ecb3affb82 (patch)
treefd641989efbaec56956bbadaa9cbe2fd7ce5e3c2 /mocker.py
parent1a572f6c05cc6c7aa2b58e810684525cb8b66de7 (diff)
downloadmocker-3a4c487d0d08f51dca83e31f35aae5ecb3affb82.tar.gz
Fixed support for MockerTestCase.addCleanup() in Python 2.3,
by Anders F Björklund (#528657).
Diffstat (limited to 'mocker.py')
-rw-r--r--mocker.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mocker.py b/mocker.py
index 336e696..ae7970c 100644
--- a/mocker.py
+++ b/mocker.py
@@ -189,6 +189,15 @@ class MockerTestCase(unittest.TestCase):
super(MockerTestCase, self).__init__(methodName)
+ def __call__(self, *args, **kwargs):
+ # This is necessary for Python 2.3 only, because it didn't use run(),
+ # which is supported above.
+ try:
+ super(MockerTestCase, self).__call__(*args, **kwargs)
+ finally:
+ if sys.version_info < (2, 4):
+ self.__cleanup()
+
def __cleanup(self):
for path in self.__cleanup_paths:
if os.path.isfile(path):