From e8d769e50d0aeb2b13a07be26790bab9473abe39 Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Sep 11 2021 12:06:34 +0000 Subject: Import python-hamcrest-1.9.0-16.el9 in CloudSIG xena --- diff --git a/.python-hamcrest.metadata b/.python-hamcrest.metadata new file mode 100644 index 0000000..79e9265 --- /dev/null +++ b/.python-hamcrest.metadata @@ -0,0 +1 @@ +0e45ceeb15bf74ffb6e3bfc103e0ffff47b26c6b SOURCES/python-hamcrest-1.9.0.tar.gz diff --git a/SOURCES/0001-Add-boolean-matchers.patch b/SOURCES/0001-Add-boolean-matchers.patch new file mode 100644 index 0000000..f3fdde2 --- /dev/null +++ b/SOURCES/0001-Add-boolean-matchers.patch @@ -0,0 +1,134 @@ +From 37a4d0dbeb9a92b959edfb9b1aceba4eaacf9f78 Mon Sep 17 00:00:00 2001 +From: Alex Panov +Date: Sun, 15 May 2016 23:36:18 -0400 +Subject: [PATCH] Add boolean matchers + +--- + README.rst | 5 ++++ + src/hamcrest/library/__init__.py | 3 ++ + src/hamcrest/library/bool/__init__.py | 1 + + src/hamcrest/library/bool/bool_comparison.py | 22 ++++++++++++++ + tests/hamcrest_unit_test/bool/__init__.py | 0 + .../bool/bool_comparison_test.py | 34 ++++++++++++++++++++++ + 6 files changed, 65 insertions(+) + create mode 100644 src/hamcrest/library/bool/__init__.py + create mode 100644 src/hamcrest/library/bool/bool_comparison.py + 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: + * ``greater_than``, ``greater_than_or_equal_to``, ``less_than``, + ``less_than_or_equal_to`` - match numeric ordering + ++* Boolean ++ ++ * ``is_true`` - verify the value is True ++ * ``is_false`` - verify the value is False ++ + * 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 * + from hamcrest.library.number import * + from hamcrest.library.object import * + from hamcrest.library.text import * ++from hamcrest.library.bool import * + + __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' + ] +diff --git a/src/hamcrest/library/bool/__init__.py b/src/hamcrest/library/bool/__init__.py +new file mode 100644 +index 0000000..7cf13a3 +--- /dev/null ++++ b/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 +--- /dev/null ++++ b/src/hamcrest/library/bool/bool_comparison.py +@@ -0,0 +1,22 @@ ++from hamcrest.core.base_matcher import BaseMatcher ++ ++ ++class IsABool(BaseMatcher): ++ def __init__(self, boolean_value): ++ self.boolean_value = boolean_value ++ ++ def describe_to(self, description): ++ description.append_text(str(self.boolean_value)) ++ ++ def _matches(self, item): ++ if not isinstance(item, bool): ++ return False ++ return item == self.boolean_value ++ ++ ++def is_true(): ++ return IsABool(True) ++ ++ ++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 +--- /dev/null ++++ b/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 ++from hamcrest.library.bool import is_false, is_true ++from hamcrest_unit_test.matcher_test import MatcherTest ++ ++ ++class BoolComparisonTest(MatcherTest): ++ def test_true_is_true(self): ++ self.assert_matches('Is True', is_true(), True) ++ ++ def test_false_is_not_true(self): ++ self.assert_does_not_match('False', is_true(), False) ++ ++ def test_false_is_false(self): ++ self.assert_matches('False', is_false(), False) ++ ++ def test_true_is_not_false(self): ++ self.assert_does_not_match('True', is_false(), True) ++ ++ def test_number_is_not_true(self): ++ self.assert_does_not_match('True', is_true(), 1) ++ ++ def test_number_is_not_false(self): ++ self.assert_does_not_match('False', is_false(), 1) ++ ++ def test_is_true_description(self): ++ description = StringDescription() ++ is_true().describe_to(description) ++ assert_that(str(description), equal_to('True')) ++ ++ def test_is_false_description(self): ++ description = StringDescription() ++ is_false().describe_to(description) ++ assert_that(str(description), equal_to('False')) +-- +2.9.3 + diff --git a/SOURCES/0002-Silence-warnings-from-tests-due-to-use-of-old-pytest.patch b/SOURCES/0002-Silence-warnings-from-tests-due-to-use-of-old-pytest.patch new file mode 100644 index 0000000..dfae1b8 --- /dev/null +++ b/SOURCES/0002-Silence-warnings-from-tests-due-to-use-of-old-pytest.patch @@ -0,0 +1,87 @@ +From a916909e315eb219f79b99d927c54028d7af1fc4 Mon Sep 17 00:00:00 2001 +From: Simon Brunning +Date: Fri, 2 Nov 2018 09:50:20 +0000 +Subject: [PATCH] Silence warnings from tests due to use of old + pytest.parameterize() signature. + +--- + tests/hamcrest_unit_test/base_description_test.py | 8 ++++---- + tests/hamcrest_unit_test/core/is_test.py | 4 ++-- + tests/hamcrest_unit_test/core/isinstanceof_test.py | 8 ++++---- + 3 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/tests/hamcrest_unit_test/base_description_test.py b/tests/hamcrest_unit_test/base_description_test.py +index 43d9bc9..ce76557 100644 +--- 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): +diff --git a/tests/hamcrest_unit_test/core/is_test.py b/tests/hamcrest_unit_test/core/is_test.py +index 9205ddb..632c67c 100644 +--- 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_matcher(): + 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,7 @@ def test_description_uses_equal_to(arg, identity, desc): + @pytest.mark.parametrize('arg, identity', ( + ('A', str), + (1, int), +- only_py2((OldClass(), OldClass)), ++ pytest.param(OldClass(), OldClass, marks=only_py2()), + )) + def test_provides_instanceof_shortcut(arg, identity): + assert_matches(is_(identity), arg, "should match") +diff --git a/tests/hamcrest_unit_test/core/isinstanceof_test.py b/tests/hamcrest_unit_test/core/isinstanceof_test.py +index 862fd06..f74b84d 100644 +--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py ++++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py +@@ -26,7 +26,7 @@ class Child(Parent): + ('foo', instance_of((str, int))), + (1, instance_of((int, str))), + ('foo', instance_of((int, str))), +- only_py2((Parent(), instance_of(Parent))), ++ pytest.param(Parent(), instance_of(Parent), marks=only_py2()), + )) + def test_matching_evaluation(arg, matcher): + assert_matches(matcher, arg, 'same class') +@@ -35,14 +35,14 @@ def test_matching_evaluation(arg, matcher): + @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))), ++ pytest.param('not a parent', instance_of(Parent), marks=only_py2()), ++ pytest.param(None, instance_of(Parent), marks=only_py2()), + )) + def test_mismatching_evaluation(arg, matcher): + assert_does_not_match(matcher, arg, 'mismatched') + + @pytest.mark.parametrize('obj', ( +- pytest.mark.issue56(()), ++ pytest.param((), marks=pytest.mark.issue56()), + 'str', + )) + def test_matcher_creation_requires_type(obj): +-- +2.21.0 + diff --git a/SPECS/python-hamcrest.spec b/SPECS/python-hamcrest.spec new file mode 100644 index 0000000..6e42e54 --- /dev/null +++ b/SPECS/python-hamcrest.spec @@ -0,0 +1,114 @@ +%global modname hamcrest +%global origname PyHamcrest + +Name: python-%{modname} +Version: 1.9.0 +Release: 16%{?dist} +Summary: Hamcrest matchers for Python + +License: BSD +URL: https://github.com/hamcrest/PyHamcrest +Source0: %{url}/archive/V%{version}/%{name}-%{version}.tar.gz + +# https://github.com/hamcrest/PyHamcrest/commit/37a4d0dbeb9a92b959edfb9b1aceba4eaacf9f78 +Patch0001: 0001-Add-boolean-matchers.patch +# https://github.com/hamcrest/PyHamcrest/commit/f71c3c6f8af716435b6d44c007d502b6fb362e20 +Patch0002: 0002-Silence-warnings-from-tests-due-to-use-of-old-pytest.patch + +BuildArch: noarch + +%global _description \ +PyHamcrest is a framework for writing matcher objects, allowing you to\ +declaratively define "match" rules. There are a number of situations where\ +matchers are invaluable, such as UI validation, or data filtering, but it is\ +in the area of writing flexible tests that matchers are most commonly used. + +%description %{_description} + +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pytest +BuildRequires: python3-mock +BuildRequires: python3-six +Requires: python3-six + +%description -n python3-%{modname} %{_description} + +Python 3 version. + +%prep +%autosetup -n %{origname}-%{version} -p1 + +%build +%py3_build + +%install +%py3_install + +%check +# Drop coverage and other presets +mv pytest.ini pytest.ini~ +PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v + +%files -n python3-%{modname} +%{python3_sitelib}/%{origname}-*.egg-info/ +%{python3_sitelib}/%{modname}/ + +%changelog +* Wed Jan 27 2021 Fedora Release Engineering - 1.9.0-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 1.9.0-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sun May 24 2020 Miro Hrončok - 1.9.0-14 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 1.9.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sun Oct 20 2019 Miro Hrončok - 1.9.0-12 +- Subpackage python2-hamcrest has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Thu Oct 03 2019 Miro Hrončok - 1.9.0-11 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Sat Aug 17 2019 Miro Hrončok - 1.9.0-10 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 1.9.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 1.9.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 1.9.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 1.9.0-6 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 1.9.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 1.9.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 1.9.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 1.9.0-2 +- Rebuild for Python 3.6 + +* Mon Oct 03 2016 Igor Gnatenko - 1.9.0-1 +- Update to 1.9.0 + +* Sun Aug 21 2016 Igor Gnatenko - 1.8.5-2 +- Backport couple of upstream patches + +* Fri Aug 19 2016 Igor Gnatenko - 1.8.5-1 +- Initial package