diff options
author | da-woods <dw-git@d-woods.co.uk> | 2021-10-17 18:51:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 19:51:08 +0200 |
commit | a0571a69f503b1dfadc331c84b1a8522194053f5 (patch) | |
tree | 1e69eebf40ea71eecf799138f1997f735a7ba696 | |
parent | c129b15e8ee249a33ca9a5dc82a3defe509ad5c0 (diff) | |
download | cython-a0571a69f503b1dfadc331c84b1a8522194053f5.tar.gz |
Import TextTestResult in test runner instead of _TextTestResult (GH-4415)
All the versions we currently test are new enough that the alias is no longer necessary.
-rw-r--r-- | Cython/Tests/xmlrunner.py | 8 | ||||
-rwxr-xr-x | runtests.py | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/Cython/Tests/xmlrunner.py b/Cython/Tests/xmlrunner.py index a02d9d8c0..eeeb49394 100644 --- a/Cython/Tests/xmlrunner.py +++ b/Cython/Tests/xmlrunner.py @@ -43,7 +43,7 @@ from __future__ import absolute_import import os import sys import time -from unittest import TestResult, _TextTestResult, TextTestRunner +from unittest import TestResult, TextTestResult, TextTestRunner import xml.dom.minidom try: from StringIO import StringIO @@ -95,7 +95,7 @@ class _TestInfo(object): self.err, self.test_method) -class _XMLTestResult(_TextTestResult): +class _XMLTestResult(TextTestResult): """A test result class that can express test results in a XML report. Used by XMLTestRunner. @@ -103,7 +103,7 @@ class _XMLTestResult(_TextTestResult): def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1, elapsed_times=True): "Create a new instance of _XMLTestResult." - _TextTestResult.__init__(self, stream, descriptions, verbosity) + TextTestResult.__init__(self, stream, descriptions, verbosity) self.successes = [] self.callback = None self.elapsed_times = elapsed_times @@ -158,7 +158,7 @@ class _XMLTestResult(_TextTestResult): def stopTest(self, test): "Called after execute each test method." self._restore_standard_output() - _TextTestResult.stopTest(self, test) + TextTestResult.stopTest(self, test) self.stop_time = time.time() if self.callback and callable(self.callback): diff --git a/runtests.py b/runtests.py index 91dbfccda..6c5f883af 100755 --- a/runtests.py +++ b/runtests.py @@ -1626,14 +1626,11 @@ class _FakeClass(object): def shortDescription(self): return self._shortDescription -try: # Py2.7+ and Py3.2+ - from unittest.runner import _TextTestResult -except ImportError: - from unittest import _TextTestResult +from unittest import TextTestResult -class PartialTestResult(_TextTestResult): +class PartialTestResult(TextTestResult): def __init__(self, base_result): - _TextTestResult.__init__( + TextTestResult.__init__( self, self._StringIO(), True, base_result.dots + base_result.showAll*2) |