!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
This commit is contained in:
commit
b8c9d3e84e
@ -1,17 +1,15 @@
|
||||
Name: python-testtools
|
||||
Version: 2.3.0
|
||||
Release: 12
|
||||
Version: 2.4.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: python3-extras python3-mimeparse python3-pbr python3-setuptools python3-unittest2
|
||||
BuildRequires: python3-traceback2 python3-testscenarios python3-sphinx python3-devel
|
||||
BuildArch: noarch
|
||||
Patch0: testtools-2.4.0-fix-py3-compat.patch
|
||||
|
||||
%description
|
||||
Testtools is a set of extensions to the Python standard library's unit testing framework. These
|
||||
@ -37,26 +35,17 @@ 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
|
||||
%py3_build
|
||||
PYTHONPATH=$PWD make -C doc html
|
||||
cd %{py3dir}
|
||||
%{__python3} setup.py build
|
||||
|
||||
%install
|
||||
cd %{py3dir}
|
||||
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||
%py3_install
|
||||
|
||||
%check
|
||||
cd %{py3dir}
|
||||
make PYTHON=%{__python3} check
|
||||
|
||||
%files -n python3-testtools
|
||||
@ -67,6 +56,9 @@ make PYTHON=%{__python3} check
|
||||
%doc doc/_build/html/*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
36
testtools-2.4.0-fix-py3-compat.patch
Normal file
36
testtools-2.4.0-fix-py3-compat.patch
Normal file
@ -0,0 +1,36 @@
|
||||
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
|
||||
|
||||
BIN
testtools-2.4.0.tar.gz
Normal file
BIN
testtools-2.4.0.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user