Skip to content

Commit

Permalink
Use the non-depcrecated TextTestResult instead of _TextTestResult (GH…
Browse files Browse the repository at this point in the history
…-333)

"_TextTestResult" was removed from Python 3.11.
"TextTestResult" is available on all supported Python versions.
  • Loading branch information
hroncok authored and scoder committed Dec 10, 2021
1 parent d85c6de commit 4b220b5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions test.py
Expand Up @@ -72,11 +72,7 @@
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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4b220b5

Please sign in to comment.