summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorMiro HronĨok <miro@hroncok.cz>2021-11-29 09:15:30 +0100
committerGitHub <noreply@github.com>2021-11-29 09:15:30 +0100
commitac6b00dd7e60f2fc85baf28799596b0e005e9627 (patch)
tree319411f8a1dba50daf84d7f9013bf65c8cbc9b79 /test.py
parentd3b9676f7fe6aaf388577c9a4c446bbe2f92c307 (diff)
downloadpython-lxml-ac6b00dd7e60f2fc85baf28799596b0e005e9627.tar.gz
Use the non-depcrecated TextTestResult instead of _TextTestResult (GH-333)
"_TextTestResult" was removed from Python 3.11. "TextTestResult" is available on all supported Python versions.
Diffstat (limited to 'test.py')
-rw-r--r--test.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/test.py b/test.py
index 45d52a9e..d523e708 100644
--- a/test.py
+++ b/test.py
@@ -72,11 +72,7 @@ import getopt
import unittest
import traceback
-try:
- # Python >=2.7 and >=3.2
- from unittest.runner import _TextTestResult
-except ImportError:
- from unittest import _TextTestResult
+from unittest import TextTestResult
__metaclass__ = type
@@ -307,14 +303,14 @@ def get_test_hooks(test_files, cfg, cov=None):
return results
-class CustomTestResult(_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 = _TextTestResult
+ __super = TextTestResult
__super_init = __super.__init__
__super_startTest = __super.startTest
__super_stopTest = __super.stopTest