47 lines
1.3 KiB
Diff
47 lines
1.3 KiB
Diff
From 5550b4e615178a559027a31b353ca7ee2e4ef732 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
Date: Fri, 26 Nov 2021 15:27:38 +0100
|
|
Subject: [PATCH] Use the non-depcrecated TextTestResult instead of
|
|
_TextTestResult
|
|
|
|
_TextTestResult was removed from Python 3.11.
|
|
TextTestResult is available on all supported Python versions.
|
|
---
|
|
test.py | 10 +++-------
|
|
1 file changed, 3 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/test.py b/test.py
|
|
index 45d52a9e0..d523e7084 100644
|
|
--- a/test.py
|
|
+++ b/test.py
|
|
@@ -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
|
|
|
|
@@ -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
|