From 891f22d080402c8086a07e0d83f3fa27c3fa8e8f Mon Sep 17 00:00:00 2001
From: Simon Brunning
Date: Fri, 2 Nov 2018 09:50:20 +0000
Subject: [PATCH 1/3] Silence warnings from tests due to use of old
Hello community,
here is the log from the commit of package python-PyHamcrest for openSUSE:Factory checked in at 2019-11-22 10:26:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-PyHamcrest (Old)
and /work/SRC/openSUSE:Factory/.python-PyHamcrest.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyHamcrest"
Fri Nov 22 10:26:21 2019 rev:4 rq:750095 version:1.9.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-PyHamcrest/python-PyHamcrest.changes 2019-07-30 13:02:13.518428554 +0200
+++ /work/SRC/openSUSE:Factory/.python-PyHamcrest.new.26869/python-PyHamcrest.changes 2019-11-22 10:26:23.741256363 +0100
@@ -1,0 +2,23 @@
+Thu Nov 21 12:06:53 CET 2019 - Matej Cepl
+
+- Remove pytest4.patch and replace it with pytest4-02.patch,
+ which is the upstream gh#hamcrest/PyHamcrest#124 fixing
+ compatibility with pytest 4+ officially. And of course, we
+ don't have to massacre test files anymore.
+
+-------------------------------------------------------------------
+Tue Nov 5 11:20:23 UTC 2019 - Matej Cepl
+
+- Run spec-cleaner
+- Add pytest4.patch to make the testsuite actually really pass.
+
+-------------------------------------------------------------------
+Mon Nov 4 14:35:43 UTC 2019 - Matej Cepl
+
+- Because of gh#hamcrest/PyHamcrest#123 we have to remove
+ tests/hamcrest_unit_test/core/is{_test,instanceof_test}.py to
+ make the test suite passing.
+ Patch pytest4.patch has been removed, it was a step into dead
+ end.
+
+-------------------------------------------------------------------
Old:
----
pytest4.patch
New:
----
pytest4-02.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-PyHamcrest.spec ++++++
--- /var/tmp/diff_new_pack.NHJ6uc/_old 2019-11-22 10:26:25.341255891 +0100
+++ /var/tmp/diff_new_pack.NHJ6uc/_new 2019-11-22 10:26:25.369255882 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-PyHamcrest
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -22,23 +22,27 @@
Release: 0
Summary: Hamcrest framework for matcher objects
License: BSD-3-Clause
-Group: Development/Languages/Python
URL: https://github.com/hamcrest/PyHamcrest
# PyPi is missing tests
#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
-Patch1: pytest4.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 < 4.0}
+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
+Obsoletes: python-hamcrest < %{version}
BuildArch: noarch
%python_subpackages
++++++ pytest4-02.patch ++++++
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'), "")),
+ 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'), "", 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")