Accepting request 788637 from home:mcalabkova:branches:devel:languages:python
- Update to 2.0.2 * Make hamcrest package PEP 561 compatible, i.e. supply type hints for external use. * Drop formal support for 2.x * Drop formal support for 3.x < 3.5 * Made has_properties() report all mismatches, not just the first. * Silence warnings. * Type fixes. * Remove obsolete dependencies. * Add support up to Python 3.8 - Removed upstreamed patch pytest4-02.patch OBS-URL: https://build.opensuse.org/request/show/788637 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyHamcrest?expand=0&rev=19
This commit is contained in:
parent
6b129d17c1
commit
92db7277ce
@ -16,11 +16,11 @@ Subject: [PATCH] Add boolean matchers
|
||||
create mode 100644 tests/hamcrest_unit_test/bool/__init__.py
|
||||
create mode 100644 tests/hamcrest_unit_test/bool/bool_comparison_test.py
|
||||
|
||||
diff --git a/README.rst b/README.rst
|
||||
index 8ef46bb..d2200f8 100644
|
||||
--- a/README.rst
|
||||
+++ b/README.rst
|
||||
@@ -148,6 +148,11 @@ PyHamcrest comes with a library of useful matchers:
|
||||
Index: PyHamcrest-2.0.2/README.rst
|
||||
===================================================================
|
||||
--- PyHamcrest-2.0.2.orig/README.rst
|
||||
+++ PyHamcrest-2.0.2/README.rst
|
||||
@@ -182,6 +182,11 @@ PyHamcrest comes with a library of usefu
|
||||
* ``greater_than``, ``greater_than_or_equal_to``, ``less_than``,
|
||||
``less_than_or_equal_to`` - match numeric ordering
|
||||
|
||||
@ -32,11 +32,11 @@ index 8ef46bb..d2200f8 100644
|
||||
* Text
|
||||
|
||||
* ``contains_string`` - match part of a string
|
||||
diff --git a/src/hamcrest/library/__init__.py b/src/hamcrest/library/__init__.py
|
||||
index a5a7963..55dfcda 100644
|
||||
--- a/src/hamcrest/library/__init__.py
|
||||
+++ b/src/hamcrest/library/__init__.py
|
||||
@@ -7,6 +7,7 @@ from hamcrest.library.integration import *
|
||||
Index: PyHamcrest-2.0.2/src/hamcrest/library/__init__.py
|
||||
===================================================================
|
||||
--- PyHamcrest-2.0.2.orig/src/hamcrest/library/__init__.py
|
||||
+++ PyHamcrest-2.0.2/src/hamcrest/library/__init__.py
|
||||
@@ -6,6 +6,7 @@ from hamcrest.library.integration import
|
||||
from hamcrest.library.number import *
|
||||
from hamcrest.library.object import *
|
||||
from hamcrest.library.text import *
|
||||
@ -45,24 +45,22 @@ index a5a7963..55dfcda 100644
|
||||
__author__ = "Jon Reid"
|
||||
__copyright__ = "Copyright 2011 hamcrest.org"
|
||||
@@ -41,4 +42,6 @@ __all__ = [
|
||||
'ends_with',
|
||||
'starts_with',
|
||||
'string_contains_in_order',
|
||||
+ 'is_true',
|
||||
+ 'is_false'
|
||||
"ends_with",
|
||||
"starts_with",
|
||||
"string_contains_in_order",
|
||||
+ "is_true",
|
||||
+ "is_false",
|
||||
]
|
||||
diff --git a/src/hamcrest/library/bool/__init__.py b/src/hamcrest/library/bool/__init__.py
|
||||
new file mode 100644
|
||||
index 0000000..7cf13a3
|
||||
Index: PyHamcrest-2.0.2/src/hamcrest/library/bool/__init__.py
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/src/hamcrest/library/bool/__init__.py
|
||||
+++ PyHamcrest-2.0.2/src/hamcrest/library/bool/__init__.py
|
||||
@@ -0,0 +1 @@
|
||||
+from .bool_comparison import is_true, is_false
|
||||
diff --git a/src/hamcrest/library/bool/bool_comparison.py b/src/hamcrest/library/bool/bool_comparison.py
|
||||
new file mode 100644
|
||||
index 0000000..af7e1b6
|
||||
Index: PyHamcrest-2.0.2/src/hamcrest/library/bool/bool_comparison.py
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/src/hamcrest/library/bool/bool_comparison.py
|
||||
+++ PyHamcrest-2.0.2/src/hamcrest/library/bool/bool_comparison.py
|
||||
@@ -0,0 +1,22 @@
|
||||
+from hamcrest.core.base_matcher import BaseMatcher
|
||||
+
|
||||
@ -86,14 +84,10 @@ index 0000000..af7e1b6
|
||||
+
|
||||
+def is_false():
|
||||
+ return IsABool(False)
|
||||
diff --git a/tests/hamcrest_unit_test/bool/__init__.py b/tests/hamcrest_unit_test/bool/__init__.py
|
||||
new file mode 100644
|
||||
index 0000000..e69de29
|
||||
diff --git a/tests/hamcrest_unit_test/bool/bool_comparison_test.py b/tests/hamcrest_unit_test/bool/bool_comparison_test.py
|
||||
new file mode 100644
|
||||
index 0000000..e865365
|
||||
Index: PyHamcrest-2.0.2/tests/hamcrest_unit_test/bool/bool_comparison_test.py
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/tests/hamcrest_unit_test/bool/bool_comparison_test.py
|
||||
+++ PyHamcrest-2.0.2/tests/hamcrest_unit_test/bool/bool_comparison_test.py
|
||||
@@ -0,0 +1,34 @@
|
||||
+from hamcrest import assert_that, equal_to
|
||||
+from hamcrest.core.string_description import StringDescription
|
||||
@ -129,6 +123,3 @@ index 0000000..e865365
|
||||
+ description = StringDescription()
|
||||
+ is_false().describe_to(description)
|
||||
+ assert_that(str(description), equal_to('False'))
|
||||
--
|
||||
2.9.3
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9e672cdbe2dfd0890227c92f7c809736f9302a0bb748bbf78ba71fc7a15412d3
|
||||
size 57650
|
3
V2.0.2.tar.gz
Normal file
3
V2.0.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d5f589020ecb100c2623189a2934750e207ef324688fc4db4261cec007e740ab
|
||||
size 55491
|
@ -1,95 +0,0 @@
|
||||
From 891f22d080402c8086a07e0d83f3fa27c3fa8e8f Mon Sep 17 00:00:00 2001
|
||||
From: Simon Brunning <simon@brunningonline.net>
|
||||
Date: Fri, 2 Nov 2018 09:50:20 +0000
|
||||
Subject: [PATCH 1/3] Silence warnings from tests due to use of old
|
||||
pytest.parameterize() signature.
|
||||
|
||||
---
|
||||
tests/hamcrest_unit_test/base_description_test.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/tests/hamcrest_unit_test/base_description_test.py
|
||||
+++ b/tests/hamcrest_unit_test/base_description_test.py
|
||||
@@ -34,10 +34,10 @@ def test_append_text_delegates(desc):
|
||||
|
||||
@pytest.mark.parametrize('described, appended', (
|
||||
(Described(), 'described'),
|
||||
- pytest.mark.skipif(six.PY3, reason="py2 only")((six.u('unicode-py2'), "'unicode-py2'")),
|
||||
- pytest.mark.skipif(six.PY3, reason="py2 only")((six.b('bytes-py2'), "'bytes-py2'")),
|
||||
- pytest.mark.skipif(six.PY2, reason="py3 only")((six.u('unicode-py3'), "'unicode-py3'")),
|
||||
- pytest.mark.skipif(six.PY2, reason="py3 only")((six.b('bytes-py3'), "<b'bytes-py3'>")),
|
||||
+ pytest.param(six.u('unicode-py2'), "'unicode-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
|
||||
+ pytest.param(six.b('bytes-py2'), "'bytes-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
|
||||
+ pytest.param(six.u('unicode-py3'), "'unicode-py3'", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
|
||||
+ pytest.param(six.b('bytes-py3'), "<b'bytes-py3'>", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
|
||||
(six.u("\U0001F4A9"), six.u("'{0}'").format(six.u("\U0001F4A9"))),
|
||||
))
|
||||
def test_append_description_types(desc, described, appended):
|
||||
--- a/pytest.ini
|
||||
+++ b/pytest.ini
|
||||
@@ -1,2 +1,4 @@
|
||||
[pytest]
|
||||
addopts = --cov hamcrest --cov-report term-missing --no-cov-on-fail
|
||||
+markers =
|
||||
+ issue56
|
||||
--- a/tests/hamcrest_unit_test/core/is_test.py
|
||||
+++ b/tests/hamcrest_unit_test/core/is_test.py
|
||||
@@ -39,7 +39,7 @@ def test_description_should_pass_through
|
||||
equal_matches = pytest.mark.parametrize('arg, identity, desc', (
|
||||
('A', 'A', "'A'"),
|
||||
(5 + 3, 8, "<8>"),
|
||||
- pytest.mark.issue56((tuple(), (), "<()>")),
|
||||
+ pytest.param(tuple(), (), "<()>", marks=pytest.mark.issue56),
|
||||
))
|
||||
|
||||
equal_mismatches = pytest.mark.parametrize('arg, identity, desc', (
|
||||
@@ -65,7 +65,6 @@ def test_description_uses_equal_to(arg,
|
||||
@pytest.mark.parametrize('arg, identity', (
|
||||
('A', str),
|
||||
(1, int),
|
||||
- only_py2((OldClass(), OldClass)),
|
||||
))
|
||||
def test_provides_instanceof_shortcut(arg, identity):
|
||||
assert_matches(is_(identity), arg, "should match")
|
||||
--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
||||
+++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
||||
@@ -26,7 +26,6 @@ class Child(Parent):
|
||||
('foo', instance_of((str, int))),
|
||||
(1, instance_of((int, str))),
|
||||
('foo', instance_of((int, str))),
|
||||
- only_py2((Parent(), instance_of(Parent))),
|
||||
))
|
||||
def test_matching_evaluation(arg, matcher):
|
||||
assert_matches(matcher, arg, 'same class')
|
||||
@@ -35,19 +34,10 @@ def test_matching_evaluation(arg, matche
|
||||
@pytest.mark.parametrize('arg, matcher', (
|
||||
('hi', instance_of(int)),
|
||||
(None, instance_of(int)),
|
||||
- only_py2(('not a parent', instance_of(Parent))),
|
||||
- only_py2((None, instance_of(Parent))),
|
||||
))
|
||||
def test_mismatching_evaluation(arg, matcher):
|
||||
assert_does_not_match(matcher, arg, 'mismatched')
|
||||
|
||||
-@pytest.mark.parametrize('obj', (
|
||||
- pytest.mark.issue56(()),
|
||||
- 'str',
|
||||
-))
|
||||
-def test_matcher_creation_requires_type(obj):
|
||||
- with pytest.raises(TypeError):
|
||||
- instance_of(obj)
|
||||
|
||||
@pytest.mark.parametrize('desc, type', (
|
||||
('an instance of int', int),
|
||||
--- a/tests/hamcrest_unit_test/matcher_test.py
|
||||
+++ b/tests/hamcrest_unit_test/matcher_test.py
|
||||
@@ -77,9 +77,3 @@ def assert_describe_mismatch(expected, m
|
||||
description = StringDescription()
|
||||
matcher.describe_mismatch(arg, description)
|
||||
assert expected == str(description)
|
||||
-
|
||||
-
|
||||
-only_py3 = pytest.mark.skipif(sys.version_info < (3, ),
|
||||
- reason="Only relevant in Python 3")
|
||||
-only_py2 = pytest.mark.skipif(sys.version_info >= (3, ),
|
||||
- reason="Only relevant in Python 2")
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 26 16:28:58 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
|
||||
|
||||
- Update to 2.0.2
|
||||
* Make hamcrest package PEP 561 compatible, i.e. supply type hints for external use.
|
||||
* Drop formal support for 2.x
|
||||
* Drop formal support for 3.x < 3.5
|
||||
* Made has_properties() report all mismatches, not just the first.
|
||||
* Silence warnings.
|
||||
* Type fixes.
|
||||
* Remove obsolete dependencies.
|
||||
* Add support up to Python 3.8
|
||||
- Removed upstreamed patch pytest4-02.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 21 12:06:53 CET 2019 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-PyHamcrest
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LLC
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,8 +17,9 @@
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python2 1
|
||||
Name: python-PyHamcrest
|
||||
Version: 1.9.0
|
||||
Version: 2.0.2
|
||||
Release: 0
|
||||
Summary: Hamcrest framework for matcher objects
|
||||
License: BSD-3-Clause
|
||||
@ -27,20 +28,12 @@ URL: https://github.com/hamcrest/PyHamcrest
|
||||
#Source: https://files.pythonhosted.org/packages/source/P/PyHamcrest/PyHamcrest-%%{version}.tar.gz
|
||||
Source: https://github.com/hamcrest/PyHamcrest/archive/V%{version}.tar.gz
|
||||
Patch0: 0001-Add-boolean-matchers.patch
|
||||
# # PATCH-FIX-UPSTREAM pytest4.patch gh#hamcrest/PyHamcrest#123 mcepl@suse.com
|
||||
# # eliminate non-compatible test case
|
||||
# Patch1: pytest4.patch
|
||||
# PATCH-FIX-UPSTREAM pytest4-02.patch gh#hamcrest/PyHamcrest#123 mcepl@suse.com
|
||||
# compatibility with pytest4+ (from gh#hamcrest/PyHamcrest#124)
|
||||
Patch1: pytest4-02.patch
|
||||
BuildRequires: %{python_module hypothesis >= 1.11}
|
||||
BuildRequires: %{python_module mock}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module six >= 1.4}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-six >= 1.4
|
||||
Provides: python-hamcrest = %{version}
|
||||
Obsoletes: python-hamcrest < %{version}
|
||||
BuildArch: noarch
|
||||
@ -55,8 +48,6 @@ allowing you to declaratively define “match” rules.
|
||||
%setup -q -n PyHamcrest-%{version}
|
||||
%autopatch -p1
|
||||
|
||||
rm pytest.ini
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user