fix for unittest changes in upcoming Py2.7 and Py3.2
authorLisandro Dalcin <dalcinl@gmail.com>
Wed, 14 Oct 2009 18:57:48 +0000 (15:57 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Wed, 14 Oct 2009 18:57:48 +0000 (15:57 -0300)
runtests.py

index c19a290381d12e838c5a5591c26aa5477b53139a..201f191fe09b4d75c47662755339a8f89fede5cc 100644 (file)
@@ -427,9 +427,14 @@ class _FakeClass(object):
     def __init__(self, **kwargs):
         self.__dict__.update(kwargs)
 
-class PartialTestResult(unittest._TextTestResult):
+try: # Py2.7+ and Py3.2+
+    from unittest.runner import _TextTestResult
+except ImportError:
+    from unittest import _TextTestResult
+
+class PartialTestResult(_TextTestResult):
     def __init__(self, base_result):
-        unittest._TextTestResult.__init__(
+        _TextTestResult.__init__(
             self, self._StringIO(), True,
             base_result.dots + base_result.showAll*2)