!8 Fix compilation failures
From: @wk333 Reviewed-by: @licihua Signed-off-by: @licihua
This commit is contained in:
commit
62239e7d9f
65
fix-import-collections-error.patch
Normal file
65
fix-import-collections-error.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
From 9f0e834b2e5eea5dfe21d5be4ea6a3df47baf0b9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Timo Furrer <timo.furrer@roche.com>
|
||||||
|
Date: Wed, 20 Feb 2019 13:26:46 +0100
|
||||||
|
Subject: [PATCH] Import ABCs from collections.abc. Closes #150
|
||||||
|
|
||||||
|
---
|
||||||
|
.travis.yml | 10 +++++++---
|
||||||
|
sure/compat.py | 5 +++++
|
||||||
|
sure/old.py | 5 +----
|
||||||
|
tests/test_assertion_builder.py | 2 +-
|
||||||
|
4 files changed, 14 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/sure/compat.py b/sure/compat.py
|
||||||
|
index df8d323..c53ab28 100644
|
||||||
|
--- a/sure/compat.py
|
||||||
|
+++ b/sure/compat.py
|
||||||
|
@@ -5,6 +5,11 @@
|
||||||
|
import six
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
+try:
|
||||||
|
+ from collections.abc import Iterable
|
||||||
|
+except ImportError:
|
||||||
|
+ from collections import Iterable
|
||||||
|
+
|
||||||
|
from sure.terminal import red, green, yellow
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/sure/old.py b/sure/old.py
|
||||||
|
index e861b26..53e4ee4 100644
|
||||||
|
--- a/sure/old.py
|
||||||
|
+++ b/sure/old.py
|
||||||
|
@@ -22,10 +22,6 @@
|
||||||
|
from copy import deepcopy
|
||||||
|
from pprint import pformat
|
||||||
|
from functools import wraps
|
||||||
|
-try:
|
||||||
|
- from collections import Iterable
|
||||||
|
-except ImportError:
|
||||||
|
- Iterable = (list, dict, tuple, set)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import __builtin__ as builtins
|
||||||
|
@@ -43,6 +39,7 @@
|
||||||
|
from sure.core import _get_file_name
|
||||||
|
from sure.core import _get_line_number
|
||||||
|
from sure.core import itemize_length
|
||||||
|
+from sure.compat import Iterable
|
||||||
|
|
||||||
|
|
||||||
|
def identify_callable_location(callable_object):
|
||||||
|
diff --git a/tests/test_assertion_builder.py b/tests/test_assertion_builder.py
|
||||||
|
index 4dc00fc..c043648 100644
|
||||||
|
--- a/tests/test_assertion_builder.py
|
||||||
|
+++ b/tests/test_assertion_builder.py
|
||||||
|
@@ -137,7 +137,7 @@ def test_should_be_a():
|
||||||
|
("this(None).should.be.none")
|
||||||
|
|
||||||
|
assert this(1).should.be.an(int)
|
||||||
|
- assert this([]).should.be.a('collections.Iterable')
|
||||||
|
+ assert this([]).should.be.a('sure.compat.Iterable')
|
||||||
|
assert this({}).should_not.be.a(list)
|
||||||
|
|
||||||
|
def opposite():
|
||||||
@ -1,10 +1,14 @@
|
|||||||
Name: python-sure
|
Name: python-sure
|
||||||
Version: 1.4.11
|
Version: 1.4.11
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: Utility belt for automated testing in Python
|
Summary: Utility belt for automated testing in Python
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: https://github.com/gabrielfalcao/sure
|
URL: https://github.com/gabrielfalcao/sure
|
||||||
Source0: https://files.pythonhosted.org/packages/source/s/sure/sure-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/s/sure/sure-%{version}.tar.gz
|
||||||
|
# https://github.com/gabrielfalcao/sure/commit/9f0e834
|
||||||
|
Patch0: fix-import-collections-error.patch
|
||||||
|
# https://src.fedoraproject.org/rpms/python-sure/pull-request/1
|
||||||
|
Patch1: python3.10-workaround.patch
|
||||||
|
|
||||||
BuildRequires: python3-devel python3-mock python3-nose python3-setuptools python3-six
|
BuildRequires: python3-devel python3-mock python3-nose python3-setuptools python3-six
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -40,6 +44,9 @@ rm -rf sure.egg-info
|
|||||||
%{python3_sitelib}/*
|
%{python3_sitelib}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 01 2022 wangkai <wangkai385@huawei.com> - 1.4.11-7
|
||||||
|
- Fix compilation failures
|
||||||
|
|
||||||
* Wed Aug 05 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.4.11-6
|
* Wed Aug 05 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.4.11-6
|
||||||
- Remove python2
|
- Remove python2
|
||||||
|
|
||||||
|
|||||||
27
python3.10-workaround.patch
Normal file
27
python3.10-workaround.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 72ca38f8124b3f29ea7a54af9d190deae3367abc Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 1 Apr 2022 11:42:10 +0800
|
||||||
|
Subject: [PATCH] python3.10-workaround
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/tests/test_old_api.py b/tests/test_old_api.py
|
||||||
|
index d63d8fe..2f93bc5 100644
|
||||||
|
--- a/tests/test_old_api.py
|
||||||
|
+++ b/tests/test_old_api.py
|
||||||
|
@@ -57,10 +57,10 @@ def test_context_is_not_optional():
|
||||||
|
assert True
|
||||||
|
|
||||||
|
assert that(it_crashes).raises(
|
||||||
|
- TypeError, (
|
||||||
|
- "the function it_crashes defined at test_old_api.py line 56, is being "
|
||||||
|
- "decorated by either @that_with_context or @scenario, so it should "
|
||||||
|
- "take at least 1 parameter, which is the test context"),
|
||||||
|
+ TypeError,
|
||||||
|
+ # intentionally empty line 1
|
||||||
|
+ # intentionally empty line 2
|
||||||
|
+ # intentionally empty line 3
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user