summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2011-09-06 16:11:13 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2011-09-06 16:11:13 +0200
commit2b9b364f3130bd240c22939f2482a9f87b0c6b30 (patch)
tree7771208be7a530a1a6c52ce1f16305aa3ee5ddb6
parentb4503f620b731984efce8c97086868c21431d807 (diff)
downloadlogilab-common-2b9b364f3130bd240c22939f2482a9f87b0c6b30.tar.gz
hack to avoid crash if error during doctest
-rw-r--r--testlib.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/testlib.py b/testlib.py
index e44c2b2..da49387 100644
--- a/testlib.py
+++ b/testlib.py
@@ -484,8 +484,8 @@ class TestCase(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(TestCase, self).__init__(methodName)
- # internal API changed in python2.5
- if sys.version_info >= (2, 5):
+ # internal API changed in python2.4 and needed by DocTestCase
+ if sys.version_info >= (2, 4):
self.__exc_info = sys.exc_info
self.__testMethodName = self._testMethodName
else:
@@ -1207,6 +1207,9 @@ class DocTest(TestCase):
finder = DocTestFinder(skipped=self.skipped)
if sys.version_info >= (2, 4):
suite = doctest.DocTestSuite(self.module, test_finder=finder)
+ if sys.version_info >= (2, 5):
+ # XXX iirk
+ doctest.DocTestCase._TestCase__exc_info = sys.exc_info
else:
suite = doctest.DocTestSuite(self.module)
except AttributeError: