From fb3e2c7fa2483de74f0dc78294c598fb1fb635d0af81dfaadf1c0753447d0383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Tue, 5 Nov 2024 15:33:11 +0000 Subject: [PATCH] - do not require python-purl - added patches fix https://github.com/jamielennox/requests-mock/issues/266 + python-requests-mock-no-purl.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests-mock?expand=0&rev=64 --- .gitattributes | 23 ++ .gitignore | 1 + python-requests-mock-no-purl.patch | 28 +++ python-requests-mock.changes | 352 +++++++++++++++++++++++++++++ python-requests-mock.spec | 70 ++++++ requests-mock-1.12.1.tar.gz | 3 + 6 files changed, 477 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-requests-mock-no-purl.patch create mode 100644 python-requests-mock.changes create mode 100644 python-requests-mock.spec create mode 100644 requests-mock-1.12.1.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-requests-mock-no-purl.patch b/python-requests-mock-no-purl.patch new file mode 100644 index 0000000..c80db27 --- /dev/null +++ b/python-requests-mock-no-purl.patch @@ -0,0 +1,28 @@ +Index: requests-mock-1.12.1/tests/test_adapter.py +=================================================================== +--- requests-mock-1.12.1.orig/tests/test_adapter.py ++++ requests-mock-1.12.1/tests/test_adapter.py +@@ -14,9 +14,14 @@ import http.client + import io + import json + import re ++import unittest + import urllib.parse + +-import purl ++with_purl = True ++try: ++ import purl ++except: ++ with_purl = False + import requests + from urllib3 import HTTPResponse + +@@ -345,6 +350,7 @@ class SessionAdapterTests(base.TestCase) + resp = self.session.get(u) + self.assertEqual('resp', resp.text) + ++ @unittest.skipUnless(with_purl, "purl not available") + def test_with_purl(self): + self.adapter.register_uri('GET', + purl.URL('mock://www.tester.com/a'), diff --git a/python-requests-mock.changes b/python-requests-mock.changes new file mode 100644 index 0000000..cad7ca0 --- /dev/null +++ b/python-requests-mock.changes @@ -0,0 +1,352 @@ +------------------------------------------------------------------- +Tue Nov 5 13:07:00 UTC 2024 - pgajdos@suse.com + +- do not require python-purl +- added patches + fix https://github.com/jamielennox/requests-mock/issues/266 + + python-requests-mock-no-purl.patch + +------------------------------------------------------------------- +Wed May 8 06:40:50 UTC 2024 - Steve Kowalik + +- Use the %pyunittest macro to run tests (because of testtools) + +------------------------------------------------------------------- +Sat Apr 6 12:15:42 UTC 2024 - Dirk Müller + +- update to 1.12.1: + * Set python_requires to >3 to prevent installation in python2 + deployments. +- update to 1.12.0: + * Remove py2 + * Allow `raw` parameter to accept callable like body elements + * Improve type definition of `Mocker.__call__` + * Drop PBR Support + * fix(mocker.pyi): fix Mocker class type hints + * Remove unused `six` dependency + +------------------------------------------------------------------- +Wed Mar 13 06:30:28 UTC 2024 - Steve Kowalik + +- Drop unneeded Requires, and also no longer restrict urllib3. +- Switch to pyproject macros. + +------------------------------------------------------------------- +Mon Jul 17 16:25:53 UTC 2023 - Dirk Müller + +- update to 1.11.0: + * Exposes some public type aliases (for type hinting only, they + can't be instanciated) + * for the types intended to be used by `requests_mock` users. + * The following types are now exposed: + * `requests_mock.Context` used in callbacks + * `requests_mock.Request` used in callbacks, which is a + `requests.PreparedRequest` proxy. + * `requests_mock.Callback[T]` which is the callbacks type. + * .. _requests-mock_1.11.0_Bug Fixes: + * Some typing inconsistencies have been fixed. + * Especially for `request` object in signatures which is in + fact a `requests_mock.Request` object. + * Fix incompatibility with urllib3 >2.0.0. In 2.0.0 they + default to enforcing content length checking on returned bodies + in responses from the previous default of false. However the flag + is still available so for compatibility we can just default + the other way. +- drop remove-mock.patch (upstream) + +------------------------------------------------------------------- +Fri Apr 21 12:33:00 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:44:29 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Wed Feb 1 20:37:16 UTC 2023 - Dirk Müller + +- switch to run tests with pytest +- build with all python flavors for SLE 15 SP4+ + +------------------------------------------------------------------- +Sat Jan 7 22:55:58 UTC 2023 - Dirk Müller + +- update to 1.10.0: + * Add a release note for the RLock + * Allow passing json\_encoder to mocking + * Improvements to Type Hints + * Lint fix for long line exception + * Shorten line length of comments + * Workaround for python2.7 not supporting lock timeout + * Comments to explain reentrant behaviour + * Change to use RLock and set a timeout to prevent infinite deadlocks + * Update homepage/doc URLs of requests library + * Add comment for pytest late loading feature + * pytest plugin should lazy-load requests\_mock + * Add test for threaded race condition + * Use threading.Lock() to prevent race conditions around monkeypatching of + get\_adapter() + * add GitHub URL for PyPi + * Add reset methods on the Mocker class type + * Avoid using distutils to check pytest version + * YAML quoting + * Support Python 3.10 + * Minor changes to code snippet example + * Fix DeprecationWarnings in setup.cfg keys + * a few minor fixes and proposed changes to documentation files + * Improve response-related param type hints + * Explicitly indicate start of keyword-only args + * Fix failing pytest + +------------------------------------------------------------------- +Fri Jul 22 11:15:27 UTC 2022 - Steve Kowalik + +- Add patch remove-mock.patch: + * Use unittest.mock if available. + +------------------------------------------------------------------- +Sun Jun 6 11:58:05 UTC 2021 - Dirk Müller + +- update to 1.9.3: + * Release note for 1.9.3 type annotations + * Additional improvements to response matching type stubs + * Improve MockerCore type stubs + +------------------------------------------------------------------- +Tue May 18 21:08:38 UTC 2021 - Dirk Müller + +- update to 1.9.2: + * Add release note for urlquote fix + * Simple tests to ensure character encoding works + * Use requests to quote URLs + * Remove circleci badge from README + * Restore py.typed file to enable types + * Change tag pattern + * Url Quote the path provided to the mocker + * Use github action to push a release to PyPI (#163) + * Release note for type hints + * Add [PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints + * Mocker.copy: Use correct type when copying mocker + * Run unit tests for pull requests as well + * Add support for Python up to 3.9 + * Use Github Actions + * Make is\_bound\_method private + * Add release note for fixed bug + * Correctly handle an explicit zero byte read + * Add missing string delimiter in example + * fix: is\_bound\_method by six + * fix: \`session\` and \`real\_http\` cannot be used at the same time + +------------------------------------------------------------------- +Wed Dec 9 10:26:01 UTC 2020 - Benjamin Greiner + +- Support TW with multiple python3 flavors + * gh#openSUSE/python-rpm-macros#66 + * fix BuildRequires + * fix %python_expand $python executable replacement + +------------------------------------------------------------------- +Sun Jun 14 09:11:15 UTC 2020 - Dirk Mueller + +- update to 1.8.0: + * Remove requests 2.3 compatibility code + * Add release notes for reset function + * Add release note for session scoped mock + * Allow passing session as postiional argument + * Create bound method instead of a wrapper + * Added reset\_mock to \_RequestHistoryTracker and Adapter (#139) + * doc on session Mockers + * doc on nesting Mockers + * fix README.rst typo + * suggest Mocker for users unfamiliar with adapters + * update examples to mount adapter on 'mock://' + * fix global/session mock interactions and real\_http + * Added installation instructions + * Add release note for nested mocking + * fix redirects (#105) and mock nesting (#116) + * Mark IOReader object closed when using a stream + * Add the default response reason if not set + * Don't check that proxies are set in test + * Add StackOverflow tag to README + * Mention pytest fixture on the README + * Add background information to pytest doc + * docs: update examples to match Read the Docs + * Expose real\_http as a public property + * fix py27 error + * easier session scoped mock + +------------------------------------------------------------------- +Sun Sep 15 11:17:30 UTC 2019 - Jan Engelhardt + +- Use noun phrsae in summary. + +------------------------------------------------------------------- +Tue Sep 10 10:49:05 UTC 2019 - Tomáš Chvátal + +- Update to 1.7.0: + * support for purl + +------------------------------------------------------------------- +Fri Jun 7 11:54:36 UTC 2019 - Tomáš Chvátal + +- Update dependencies +- Run also pytest tests +- Fix fdupes call + +------------------------------------------------------------------- +Tue May 7 13:19:56 UTC 2019 - pgajdos@suse.com + +- version update to 1.6.0 + * Respect user provided content encoding type + * Update minimum requests version to 2.3 + * Add testing for Python 3.7 & PyPy3 + * Drop \_matcher from request pickled state + * Clarify the pytest configuration documentation + +------------------------------------------------------------------- +Thu Mar 7 15:00:19 UTC 2019 - Thomas Bechtold + +- update to 1.5.2: + * Fix discovery of pytest version and default + * Add a docstring to the pytest fixture + * Include release note for py.test + * Collapse CircleCI configuration + * Support older pytest versions + * Record value of stream parameter in request history + * Some additional gitignores + * Include reno in circleci publish job + * Prefer readthedocs.io instead of readthedocs.org for doc links + * Add release note describe repository migration + * Add pytest plugin + * Include release-notes in documentation + * Another attempt at circleci tags + * Only try and push to pypi on a tag + * Update all pypi.python.org URLs to pypi.org + * Add pypi upload configuration to circleci + * Move tests outside of package to top level directory + * Remove zuul.yaml as we're not using zuul anymore + * Add CircleCI badge to README + * Remove links to launchpad bug reporting + * Remove .gitreview + * Unpin sphinx dependency + * Add circleci testing configuration + * Use set literals throughout project + * Prefer https:// links over http:// in docs and comments + * Fix last\_request examples + * Fix spelling mistakes + * Move Zuul jobs in-tree + +------------------------------------------------------------------- +Tue Dec 4 12:53:47 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Fri Feb 23 13:52:35 UTC 2018 - tbechtold@suse.com + +- update to 1.4.0: + * allow an adapter to be passed to a Mocker object + * Rename [wheel] section to [bdist\_wheel] as the former is legacy + * Include license file in the generated wheel package + * Add testing for newer Python versions 3.5 and 3.6 + * Return a separate copy for each call to decorator + * Add string representation to \_RequestObjectProxy + +------------------------------------------------------------------- +Wed Jun 14 16:37:14 UTC 2017 - dmueller@suse.com + +- fix build for SLE12 + +------------------------------------------------------------------- +Sat Jun 10 07:47:41 UTC 2017 - dmueller@suse.com + +- update to 1.3.0: + * Add a releasenote for additional_matcher + * Add documentation for the exception response + * Fix occurences of `adatper` + * Type check the empty string when creating repsonse + * Allow arbirtrary matcher to be add to match + +------------------------------------------------------------------- +Thu May 25 15:22:58 UTC 2017 - sebix+novell.com@sebix.at + +- convert to singlespec + +------------------------------------------------------------------- +Mon Jan 30 11:04:29 UTC 2017 - tbechtold@suse.com + +- update to 1.2.0: + * Allow for nested mocking + * Use create_response for fake http response in tests + * Add hostname and port properties to request + * Move request code and tests into their own files + * Add called_once to Mocker + * Fix docs building + * Fix exception message when creating a response + +------------------------------------------------------------------- +Wed Sep 28 09:00:13 UTC 2016 - tbechtold@suse.com + +- update to 1.1.0: + * Add a called_once property to adapter + * Enable case sensitive matching + * Provide fixture extras for pip + * Allow doing real_http per mock via the mocker + * Return b'' when reading closed response + * Fixture documentation error + +------------------------------------------------------------------- +Fri Jul 8 08:55:29 UTC 2016 - dmueller@suse.com + +- fix source url + +------------------------------------------------------------------- +Wed Jul 6 16:13:45 UTC 2016 - tbechtold@suse.com + +- update to 1.0.0: + * Add tox environment to run against master requests + * Change dev status classifier to stable + * Doc fixups + * Expose cert and proxies as attributes of the last request + * Add timeout and allow_retries to RequestProxy + * Fix py34 DB issue and remove py33/py26 + * Remove pypip.in badge from readme + +------------------------------------------------------------------- +Fri Dec 4 07:59:17 UTC 2015 - dmueller@suse.com + +- update to 0.7.0: + * Support Cookies + * Expose Fake objects in compat + * Update .gitreview for new namespace + * Change ignore-errors to ignore_errors + +------------------------------------------------------------------- +Mon Apr 20 13:48:07 UTC 2015 - tbechtold@suse.com + +- Fix license string + +------------------------------------------------------------------- +Mon Feb 2 15:25:27 UTC 2015 - dmueller@suse.com + +- update 0.6.0: + * Update docs + * Allow to decorate class with mock + * Use weakref to hold matcher + * Include matcher in request history + * Add called and call_count to mocker + * Update README to use newer syntax + * Allow specifying an exception to raise + * Update novaclient and keystoneclient git repo + * Add pbr to all tox environments + * Add docs environment to tox.ini + * Work toward Python 3.4 support and testing + * Run tip tests against requests master as well + * Add link to find bug tracker + +------------------------------------------------------------------- +Fri Sep 26 07:45:55 UTC 2014 - tbechtold@suse.com + +- Initial package diff --git a/python-requests-mock.spec b/python-requests-mock.spec new file mode 100644 index 0000000..a89662d --- /dev/null +++ b/python-requests-mock.spec @@ -0,0 +1,70 @@ +# +# spec file for package python-requests-mock +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-requests-mock +Version: 1.12.1 +Release: 0 +Summary: Module to mock out responses from the requests package +License: Apache-2.0 +URL: https://github.com/jamielennox/requests-mock +Source: https://files.pythonhosted.org/packages/source/r/requests-mock/requests-mock-%{version}.tar.gz +# https://github.com/jamielennox/requests-mock/issues/266 +Patch0: python-requests-mock-no-purl.patch +BuildRequires: %{python_module fixtures} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests >= 2.3} +BuildRequires: %{python_module requests-futures} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module wheel} +BuildRequires: python-rpm-macros +%if 0%{suse_version} >= 1550 || (0%{?suse_version} == 1500 && 0%{?sle_version} >= 154000) +BuildRequires: %{python_module dbm} +%else +BuildRequires: python3-dbm +%endif +BuildRequires: fdupes +Requires: python-requests >= 2.3 +BuildArch: noarch +%python_subpackages + +%description +requests-mock provides a building block to stub out the HTTP requests portions of your testing code. +You should checkout the docs for more information. + +%prep +%autosetup -p1 -n requests-mock-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pyunittest + +%files %{python_files} +%license LICENSE +%doc README.rst +%{python_sitelib}/requests_mock +%{python_sitelib}/requests_mock-%{version}.dist-info + +%changelog diff --git a/requests-mock-1.12.1.tar.gz b/requests-mock-1.12.1.tar.gz new file mode 100644 index 0000000..c666b9e --- /dev/null +++ b/requests-mock-1.12.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9e12e333b525156e82a3c852f22016b9158220d2f47454de9cae8a77d371401 +size 60901