Compare commits

..

11 Commits

Author SHA1 Message Date
openeuler-ci-bot
04d35ca364
!15 Update to 2.5.0
From: @starlet-dx 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2022-10-27 07:25:41 +00:00
starlet-dx
99ea7f4830 Update to 2.5.0 2022-10-26 09:22:37 +08:00
openeuler-ci-bot
fc06d4a804
!6 修复check阶段编译失败
Merge pull request !6 from caodongxia/openEuler-22.03-LTS-Next
2022-01-08 08:28:14 +00:00
caodongxia
057873de3d fix test fail due to python3.9 2022-01-08 16:05:19 +08:00
openeuler-ci-bot
b8c9d3e84e !5 [sync] PR-4: Upgrade package to version 2.4.0 for OpenStack Wallaby support
From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-08-23 01:38:19 +00:00
sean-lau
dd7274eea9 Upgrade package to version 2.4.0 for OpenStack Wallaby support
(cherry picked from commit 8531e1f027ed54e2e6b567087d87209e223bc804)
2021-08-20 09:29:02 +08:00
openeuler-ci-bot
2019412c59 !3 del python2-testtools python2 is EOL and we recommend python3
Merge pull request !3 from zhangtao2020/master
2020-08-11 19:08:55 +08:00
zhangtao2020
5360cd0cc4 del python2-testtools python2 is EOL and we recommend python3 2020-08-11 15:28:08 +08:00
zhangtao2020
fcd29bbe2d Del Python2-testtools python2 is EOL and we recomand python3 2020-08-11 15:25:41 +08:00
openeuler-ci-bot
1ae7650a09 !2 python-testtools
Merge pull request !2 from wangef/master
2020-05-09 16:16:30 +08:00
wwx913452
2a4d0632b3 added python-testtools.yaml 2020-05-07 19:18:01 +08:00
7 changed files with 139 additions and 109 deletions

View 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

View File

@ -1,35 +1,22 @@
Name: python-testtools
Version: 2.3.0
Release: 11
Version: 2.5.0
Release: 1
Summary: Extensions to the Python unit testing framework
License: MIT
URL: https://launchpad.net/testtools
Source0: https://pypi.io/packages/source/t/testtools/testtools-%{version}.tar.gz
Patch0001: testtools-1.8.0-py3.patch
Patch0002: testtools-2.3.0-py37.patch
BuildRequires: python2-devel python2-extras python2-mimeparse >= 0.1.4 python2-pbr python2-setuptools
BuildRequires: python2-unittest2 >= 1.0.0 python2-traceback2 python2-testscenarios python3-devel
BuildRequires: python3-extras python3-mimeparse python3-pbr python3-setuptools python3-unittest2
BuildRequires: python3-traceback2 python3-testscenarios python3-sphinx
BuildRequires: python3-traceback2 python3-testscenarios python3-sphinx python3-devel
BuildArch: noarch
#https://github.com/testing-cabal/testtools/commit/ec9bb7ed026566688a14be9d8d5d1e4c506e71c0
Patch0: 0001-Add-support-for-Python-3.10.patch
%description
Testtools is a set of extensions to the Python standard library's unit testing framework. These
extensions have been derived from years of experience with unit testing in Python and come from
many different sources.
%package -n python2-testtools
Summary: Extensions to the Python unit testing framework
Requires: python2-extras python2-mimeparse python2-pbr python2-unittest2 >= 1.0.0 python2-traceback2
%{?python_provide:%python_provide python2-testtools}
%description -n python2-testtools
Testtools is a set of extensions to the Python standard library's unit testing framework. These
extensions have been derived from years of experience with unit testing in Python and come from
many different sources.
%package -n python3-testtools
Summary: Extensions to the Python unit testing framework
Requires: python3-extras python3-mimeparse python3-pbr python3-unittest2 >= 1.0.0 python3-traceback2
@ -41,7 +28,7 @@ many different sources.
%package help
Summary: Documentation for python-testtools
Requires: python2-testtools = %{version}-%{release}
Requires: python3-testtools = %{version}-%{release}
Provides: bundled(jquery) %{name}-doc = %{version}-%{release}
Obsoletes: %{name}-doc < %{version}-%{release}
@ -49,43 +36,40 @@ Obsoletes: %{name}-doc < %{version}-%{release}
This package contains HTML documentation for python-testtools.
%prep
%setup -q -n testtools-%{version}
%patch0002 -p1
rm -rf %{py3dir}
cp -a . %{py3dir}
cd %{py3dir}
%patch0001 -p1
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
rm -f %{py3dir}/testtools/_compat2x.py %{_builddir}/testtools-%{version}/testtools/_compat3x.py
%autosetup -n testtools-%{version} -p1
rm -rf testtools.egg-info
%build
%{__python2} setup.py build
%py3_build
PYTHONPATH=$PWD make -C doc html
cd %{py3dir}
%{__python3} setup.py build
%install
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
cd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%py3_install
%check
make PYTHON=%{__python2} check
cd %{py3dir}
make PYTHON=%{__python3} check
%files -n python2-testtools
%doc LICENSE NEWS README.rst
%{python2_sitelib}/*
%files -n python3-testtools
%doc LICENSE NEWS README.rst
%doc NEWS README.rst
%license LICENSE
%{python3_sitelib}/*
%files help
%doc doc/_build/html/*
%changelog
* Wed Oct 26 2022 yaoxin <yaoxin30@h-partners.com> - 2.5.0-1
- Update to 2.5.0
* Sat Jan 08 2021 caodongxia <caodongxia@huawei.com> - 2.4.0-2
- Fix test fail
* Fri Aug 06 2021 liusheng <liusheng2048@gmail.com> - 2.4.0-1
- Upgrade to version 2.4.0
* Tue Aug 11 2020 zhangtao <zhangtao221@huawei.com> - 2.3.0-12
- Del Python2-testtools python2 is EOL and we recommend python3
* Thu Feb 20 2020 lingsheng <lingsheng@huawei.com> - 2.3.0-11
- Modify buildrequires to fix build fail

4
python-testtools.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: testing-cabal/testtools
tag_prefix: testtools-
seperator: .

View File

@ -1,14 +0,0 @@
--- testtools-1.8.0/testtools/compat.py.py3 2015-03-11 04:19:19.000000000 +0700
+++ testtools-1.8.0/testtools/compat.py 2015-07-28 22:54:02.537568121 +0700
@@ -32,10 +32,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

View File

@ -1,54 +0,0 @@
From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 17 May 2018 17:52:26 +0200
Subject: [PATCH] Fix the tests on Python 3.7
Exception's repr got changed not to include trailing comma
Fixes https://github.com/testing-cabal/testtools/issues/270
---
.travis.yml | 1 +
testtools/tests/matchers/test_exception.py | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7f1f4db7..784608e0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,7 @@ python:
- "3.4"
- "3.5"
- "3.6"
+ - "3.7-dev"
- "pypy"
install:
diff --git a/testtools/tests/matchers/test_exception.py b/testtools/tests/matchers/test_exception.py
index 6cd80af1..acd39252 100644
--- a/testtools/tests/matchers/test_exception.py
+++ b/testtools/tests/matchers/test_exception.py
@@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, TestMatchersInterface):
matches_matches = [error_foo]
matches_mismatches = [error_bar, error_base_foo]
+ if sys.version_info >= (3, 7):
+ # exception's repr has changed
+ _e = ''
+ else:
+ _e = ','
+
str_examples = [
- ("MatchesException(Exception('foo',))",
+ ("MatchesException(Exception('foo'%s))" % _e,
MatchesException(Exception('foo')))
]
describe_examples = [
("%r is not a %r" % (Exception, ValueError),
error_base_foo,
MatchesException(ValueError("foo"))),
- ("ValueError('bar',) has different arguments to ValueError('foo',).",
+ ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)."
+ % (_e, _e),
error_bar,
MatchesException(ValueError("foo"))),
]

Binary file not shown.

BIN
testtools-2.5.0.tar.gz Normal file

Binary file not shown.