Backport a fix for Python 3.11
This commit is contained in:
parent
b51ac78331
commit
27eebecb4d
|
@ -0,0 +1,46 @@
|
|||
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
|
|
@ -16,6 +16,10 @@ Source0: %{pypi_source %{modname}}
|
|||
# Adapt a test to a behavioural change in libxml2 2.9.11+
|
||||
Patch1: %{url}/commit/852ed1092b.patch
|
||||
|
||||
# Use the non-depcrecated TextTestResult instead of _TextTestResult
|
||||
# _TextTestResult was removed from Python 3.11
|
||||
Patch2: %{url}/pull/333.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: libxslt-devel
|
||||
|
|
Loading…
Reference in New Issue