Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[svn r4284] 2.2 branch merge: fix test runner in Py3.1

--HG--
branch : trunk
  • Loading branch information...
commit fbe2332aa654e66ddedbfcefc09e5ff0c14821ba 1 parent d93a48b
scoder authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 test.py
View
11 test.py
@@ -71,11 +71,18 @@
import getopt
import unittest
import traceback
+
try:
set
except NameError:
from sets import Set as set
+try:
+ # Python >=2.7 and >=3.2
+ from unittest.runner import _TextTestResult
+except ImportError:
+ from unittest import _TextTestResult
+
__metaclass__ = type
def stderr(text):
@@ -302,14 +309,14 @@ def get_test_hooks(test_files, cfg, tracer=None):
return results
-class CustomTestResult(unittest._TextTestResult):
+class CustomTestResult(_TextTestResult):
"""Customised TestResult.
It can show a progress bar, and displays tracebacks for errors and failures
as soon as they happen, in addition to listing them all at the end.
"""
- __super = unittest._TextTestResult
+ __super = _TextTestResult
__super_init = __super.__init__
__super_startTest = __super.startTest
__super_stopTest = __super.stopTest
Please sign in to comment.
Something went wrong with that request. Please try again.