summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorscoder <none@none>2009-12-15 14:52:56 +0100
committerscoder <none@none>2009-12-15 14:52:56 +0100
commitfbe2332aa654e66ddedbfcefc09e5ff0c14821ba (patch)
tree7cee75eb5eee7e777deb0941fa3d19936af63c0d /test.py
parentd93a48bdd7d3981dd850e7ad656253246d23978c (diff)
downloadpython-lxml-fbe2332aa654e66ddedbfcefc09e5ff0c14821ba.tar.gz
[svn r4284] 2.2 branch merge: fix test runner in Py3.1
--HG-- branch : trunk
Diffstat (limited to 'test.py')
-rw-r--r--test.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/test.py b/test.py
index 24b1af69..2a889aea 100644
--- a/test.py
+++ b/test.py
@@ -71,11 +71,18 @@ import types
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