Skip to content

Commit 4b220b5

Browse files
hroncokscoder
authored andcommitted
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.
1 parent d85c6de commit 4b220b5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@
7272
import unittest
7373
import traceback
7474

75-
try:
76-
# Python >=2.7 and >=3.2
77-
from unittest.runner import _TextTestResult
78-
except ImportError:
79-
from unittest import _TextTestResult
75+
from unittest import TextTestResult
8076

8177
__metaclass__ = type
8278

@@ -307,14 +303,14 @@ def get_test_hooks(test_files, cfg, cov=None):
307303
return results
308304

309305

310-
class CustomTestResult(_TextTestResult):
306+
class CustomTestResult(TextTestResult):
311307
"""Customised TestResult.
312308
313309
It can show a progress bar, and displays tracebacks for errors and failures
314310
as soon as they happen, in addition to listing them all at the end.
315311
"""
316312

317-
__super = _TextTestResult
313+
__super = TextTestResult
318314
__super_init = __super.__init__
319315
__super_startTest = __super.startTest
320316
__super_stopTest = __super.stopTest

0 commit comments

Comments
 (0)