!14 Update to 2.5.0
From: @starlet-dx Reviewed-by: @licihua Signed-off-by: @licihua
This commit is contained in:
commit
de7a49d0db
110
0001-Add-support-for-Python-3.10.patch
Normal file
110
0001-Add-support-for-Python-3.10.patch
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
From 42691df705a895a42160c21cc13a7e0a99332a80 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= <juergen.gmach@googlemail.com>
|
||||||
|
Date: Thu, 14 Oct 2021 21:00:21 +0200
|
||||||
|
Subject: [PATCH 1/3] Add support for Python 3.10
|
||||||
|
|
||||||
|
(cherry picked from commit ec9bb7ed026566688a14be9d8d5d1e4c506e71c0)
|
||||||
|
---
|
||||||
|
.github/workflows/test.yml | 2 +-
|
||||||
|
NEWS | 9 +++++++++
|
||||||
|
scripts/all-pythons | 2 +-
|
||||||
|
setup.cfg | 1 +
|
||||||
|
testtools/tests/test_testresult.py | 5 ++++-
|
||||||
|
tox.ini | 2 +-
|
||||||
|
6 files changed, 17 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
|
||||||
|
index 70cacf7..44c27b7 100644
|
||||||
|
--- a/.github/workflows/test.yml
|
||||||
|
+++ b/.github/workflows/test.yml
|
||||||
|
@@ -8,7 +8,7 @@ jobs:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
- python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10-dev, pypy3]
|
||||||
|
+ python-version: [3.5, 3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
diff --git a/NEWS b/NEWS
|
||||||
|
index df49f5e..cf7f84f 100644
|
||||||
|
--- a/NEWS
|
||||||
|
+++ b/NEWS
|
||||||
|
@@ -3,6 +3,15 @@ testtools NEWS
|
||||||
|
|
||||||
|
Changes and improvements to testtools_, grouped by release.
|
||||||
|
|
||||||
|
+NEXT
|
||||||
|
+~~~~
|
||||||
|
+
|
||||||
|
+Improvements
|
||||||
|
+------------
|
||||||
|
+
|
||||||
|
+* Add support for Python 3.10.
|
||||||
|
+ (Jürgen Gmach)
|
||||||
|
+
|
||||||
|
2.5.0
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
diff --git a/scripts/all-pythons b/scripts/all-pythons
|
||||||
|
index 6996a44..0fbe010 100755
|
||||||
|
--- a/scripts/all-pythons
|
||||||
|
+++ b/scripts/all-pythons
|
||||||
|
@@ -89,5 +89,5 @@ def now():
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.path.append(ROOT)
|
||||||
|
result = TestProtocolClient(sys.stdout)
|
||||||
|
- for version in '3.5 3.6 3.7 3.8 3.9'.split():
|
||||||
|
+ for version in '3.5 3.6 3.7 3.8 3.9 3.10'.split():
|
||||||
|
run_for_python(version, result, sys.argv[1:])
|
||||||
|
diff --git a/setup.cfg b/setup.cfg
|
||||||
|
index 36d90ce..831ed4a 100644
|
||||||
|
--- a/setup.cfg
|
||||||
|
+++ b/setup.cfg
|
||||||
|
@@ -17,6 +17,7 @@ classifier =
|
||||||
|
Programming Language :: Python :: 3.7
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
|
Programming Language :: Python :: 3.9
|
||||||
|
+ Programming Language :: Python :: 3.10
|
||||||
|
Programming Language :: Python :: 3 :: Only
|
||||||
|
Programming Language :: Python :: Implementation :: CPython
|
||||||
|
Programming Language :: Python :: Implementation :: PyPy
|
||||||
|
diff --git a/testtools/tests/test_testresult.py b/testtools/tests/test_testresult.py
|
||||||
|
index a9db0e2..4fbf15d 100644
|
||||||
|
--- a/testtools/tests/test_testresult.py
|
||||||
|
+++ b/testtools/tests/test_testresult.py
|
||||||
|
@@ -2667,16 +2667,19 @@ class TestNonAsciiResults(TestCase):
|
||||||
|
"""Syntax errors should still have fancy special-case formatting"""
|
||||||
|
if platform.python_implementation() == "PyPy":
|
||||||
|
spaces = ' '
|
||||||
|
+ marker = '^'
|
||||||
|
elif sys.version_info >= (3, 10):
|
||||||
|
spaces = ' '
|
||||||
|
+ marker = '^^^'
|
||||||
|
else:
|
||||||
|
spaces = ' '
|
||||||
|
+ marker = '^'
|
||||||
|
textoutput = self._test_external_case("exec ('f(a, b c)')")
|
||||||
|
self.assertIn(self._as_output(
|
||||||
|
' File "<string>", line 1\n'
|
||||||
|
' f(a, b c)\n'
|
||||||
|
+ ' ' * self._error_on_character +
|
||||||
|
- spaces + '^\n'
|
||||||
|
+ spaces + marker + '\n'
|
||||||
|
'SyntaxError: '
|
||||||
|
), textoutput)
|
||||||
|
|
||||||
|
diff --git a/tox.ini b/tox.ini
|
||||||
|
index 5e9ab12..0416e06 100644
|
||||||
|
--- a/tox.ini
|
||||||
|
+++ b/tox.ini
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
[tox]
|
||||||
|
-envlist = py35,py36,py37,py38,py39,310,pypy3
|
||||||
|
+envlist = py35,py36,py37,py38,py39,py310,pypy3
|
||||||
|
minversion = 1.6
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
From 840f9230f9fc4433237517310b5b3958b7382f09 Mon Sep 17 00:00:00 2001
|
|
||||||
From: caodongxia <315816521@qq.com>
|
|
||||||
Date: Sat, 2 Apr 2022 11:00:19 +0800
|
|
||||||
Subject: [PATCH] fix for python3.10
|
|
||||||
Refer: https://github.com/testing-cabal/testtools/commit/254998e2e88835eaa634d9729dddcc3d4b5bc32f
|
|
||||||
Refer: https://github.com/testing-cabal/testtools/commit/1d698cf91cb2205aedc018e465a2e17c5a6a3e94
|
|
||||||
|
|
||||||
---
|
|
||||||
testtools/tests/test_testresult.py | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/testtools/tests/test_testresult.py b/testtools/tests/test_testresult.py
|
|
||||||
index d863794..e06ea03 100644
|
|
||||||
--- a/testtools/tests/test_testresult.py
|
|
||||||
+++ b/testtools/tests/test_testresult.py
|
|
||||||
@@ -2681,6 +2681,8 @@ class TestNonAsciiResults(TestCase):
|
|
||||||
"""Syntax errors should still have fancy special-case formatting"""
|
|
||||||
if platform.python_implementation() == "PyPy":
|
|
||||||
spaces = ' '
|
|
||||||
+ elif sys.version_info >= (3, 10):
|
|
||||||
+ spaces = ' '
|
|
||||||
else:
|
|
||||||
spaces = ' '
|
|
||||||
textoutput = self._test_external_case("exec ('f(a, b c)')")
|
|
||||||
@@ -2755,6 +2757,9 @@ class TestNonAsciiResults(TestCase):
|
|
||||||
textoutput = self._setup_external_case("import bad")
|
|
||||||
self._write_module("bad", "utf-8", _u("\ufeff^ = 0 # %s\n") % text)
|
|
||||||
textoutput = self._run_external_case()
|
|
||||||
+ # Python 3.9 no longer prints the '\ufeff'
|
|
||||||
+ if sys.version_info >= (3,9):
|
|
||||||
+ textoutput = textoutput.replace('\ufeff', '')
|
|
||||||
self.assertThat(
|
|
||||||
textoutput,
|
|
||||||
MatchesRegex(
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
From d528842b99b16efce212e15dae3f0a54927d06d8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Cyril Roelandt <cyril@redhat.com>
|
|
||||||
Date: Fri, 19 Mar 2021 02:50:13 +0000
|
|
||||||
Subject: [PATCH] Fix tests with Python 3.10
|
|
||||||
|
|
||||||
In Python 3, error messages have become a bit more precise. For
|
|
||||||
instance, the following code snippet:
|
|
||||||
|
|
||||||
----
|
|
||||||
class Foo():
|
|
||||||
def bar(self, a):
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
Foo().bar(1, 2)
|
|
||||||
except TypeError as e:
|
|
||||||
print(e)
|
|
||||||
----
|
|
||||||
|
|
||||||
will return:
|
|
||||||
|
|
||||||
- in Python 3.9: "bar() takes 2 positional arguments but 3 were given"
|
|
||||||
- in Python 3.10: "Foo.bar() takes 2 positional arguments but 3 were
|
|
||||||
given"
|
|
||||||
|
|
||||||
Fix our tests accordingly.
|
|
||||||
---
|
|
||||||
testtools/tests/test_testsuite.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/testtools/tests/test_testsuite.py b/testtools/tests/test_testsuite.py
|
|
||||||
index 7ad5b74d..65cb88d7 100644
|
|
||||||
--- a/testtools/tests/test_testsuite.py
|
|
||||||
+++ b/testtools/tests/test_testsuite.py
|
|
||||||
@@ -181,7 +181,7 @@ def run(self):
|
|
||||||
test.run(process_result)
|
|
||||||
""", doctest.ELLIPSIS))
|
|
||||||
self.assertThat(events[3][6].decode('utf8'), DocTestMatches("""\
|
|
||||||
-TypeError: run() takes ...1 ...argument...2...given...
|
|
||||||
+TypeError: ...run() takes ...1 ...argument...2...given...
|
|
||||||
""", doctest.ELLIPSIS))
|
|
||||||
events = [event[0:10] + (None,) for event in events]
|
|
||||||
events[1] = events[1][:6] + (None,) + events[1][7:]
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: python-testtools
|
Name: python-testtools
|
||||||
Version: 2.4.0
|
Version: 2.5.0
|
||||||
Release: 2
|
Release: 1
|
||||||
Summary: Extensions to the Python unit testing framework
|
Summary: Extensions to the Python unit testing framework
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://launchpad.net/testtools
|
URL: https://launchpad.net/testtools
|
||||||
@ -9,12 +9,8 @@ Source0: https://pypi.io/packages/source/t/testtools/testtools-%{version}
|
|||||||
BuildRequires: python3-extras python3-mimeparse python3-pbr python3-setuptools python3-unittest2
|
BuildRequires: python3-extras python3-mimeparse python3-pbr python3-setuptools python3-unittest2
|
||||||
BuildRequires: python3-traceback2 python3-testscenarios python3-sphinx python3-devel
|
BuildRequires: python3-traceback2 python3-testscenarios python3-sphinx python3-devel
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Patch0: testtools-2.4.0-fix-py3-compat.patch
|
#https://github.com/testing-cabal/testtools/commit/ec9bb7ed026566688a14be9d8d5d1e4c506e71c0
|
||||||
#Refer: https://github.com/testing-cabal/testtools/commit/254998e2e88835eaa634d9729dddcc3d4b5bc32f
|
Patch0: 0001-Add-support-for-Python-3.10.patch
|
||||||
#Refer: https://github.com/testing-cabal/testtools/commit/1d698cf91cb2205aedc018e465a2e17c5a6a3e94
|
|
||||||
Patch1: fix-testresult-failed.patch
|
|
||||||
#Refer: https://github.com/testing-cabal/testtools/commit/d528842b99b16efce212e15dae3f0a54927d06d8
|
|
||||||
Patch2: fix-testsuite-failed.patch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Testtools is a set of extensions to the Python standard library's unit testing framework. These
|
Testtools is a set of extensions to the Python standard library's unit testing framework. These
|
||||||
@ -54,13 +50,17 @@ PYTHONPATH=$PWD make -C doc html
|
|||||||
make PYTHON=%{__python3} check
|
make PYTHON=%{__python3} check
|
||||||
|
|
||||||
%files -n python3-testtools
|
%files -n python3-testtools
|
||||||
%doc LICENSE NEWS README.rst
|
%doc NEWS README.rst
|
||||||
|
%license LICENSE
|
||||||
%{python3_sitelib}/*
|
%{python3_sitelib}/*
|
||||||
|
|
||||||
%files help
|
%files help
|
||||||
%doc doc/_build/html/*
|
%doc doc/_build/html/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 7 2022 yaoxin <yaoxin30@h-partners.com> - 2.5.0-1
|
||||||
|
- Update to 2.5.0
|
||||||
|
|
||||||
* Sat Apr 2 2022 caodongxia <caodongxia@huawei.com> - 2.4.0-2
|
* Sat Apr 2 2022 caodongxia <caodongxia@huawei.com> - 2.4.0-2
|
||||||
- Fix test_testresult and test_testsuite failed due to python3.10
|
- Fix test_testresult and test_testsuite failed due to python3.10
|
||||||
|
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
diff -urN testtools-2.4.0/testtools/_compat2x.py testtools-2.4.0-new/testtools/_compat2x.py
|
|
||||||
--- testtools-2.4.0/testtools/_compat2x.py 2015-11-08 01:27:33.000000000 +0800
|
|
||||||
+++ testtools-2.4.0-new/testtools/_compat2x.py 1970-01-01 08:00:00.000000000 +0800
|
|
||||||
@@ -1,17 +0,0 @@
|
|
||||||
-# Copyright (c) 2011 testtools developers. See LICENSE for details.
|
|
||||||
-
|
|
||||||
-"""Compatibility helpers that are valid syntax in Python 2.x.
|
|
||||||
-
|
|
||||||
-Only add things here if they *only* work in Python 2.x or are Python 2
|
|
||||||
-alternatives to things that *only* work in Python 3.x.
|
|
||||||
-"""
|
|
||||||
-
|
|
||||||
-__all__ = [
|
|
||||||
- 'reraise',
|
|
||||||
- ]
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-def reraise(exc_class, exc_obj, exc_tb, _marker=object()):
|
|
||||||
- """Re-raise an exception received from sys.exc_info() or similar."""
|
|
||||||
- raise exc_class, exc_obj, exc_tb
|
|
||||||
-
|
|
||||||
diff -urN testtools-2.4.0/testtools/compat.py testtools-2.4.0-new/testtools/compat.py
|
|
||||||
--- testtools-2.4.0/testtools/compat.py 2018-04-05 07:27:14.000000000 +0800
|
|
||||||
+++ testtools-2.4.0-new/testtools/compat.py 2021-08-06 10:55:13.294527126 +0800
|
|
||||||
@@ -33,10 +33,7 @@
|
|
||||||
# To let setup.py work, make this a conditional import.
|
|
||||||
linecache = try_import('linecache2')
|
|
||||||
|
|
||||||
-try:
|
|
||||||
- from testtools import _compat2x as _compat
|
|
||||||
-except SyntaxError:
|
|
||||||
- from testtools import _compat3x as _compat
|
|
||||||
+from testtools import _compat3x as _compat
|
|
||||||
|
|
||||||
reraise = _compat.reraise
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
testtools-2.5.0.tar.gz
Normal file
BIN
testtools-2.5.0.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user