diff --git a/0002-Use-system-urllib3-package.patch b/0002-Use-system-urllib3-package.patch new file mode 100644 index 0000000..90694e9 --- /dev/null +++ b/0002-Use-system-urllib3-package.patch @@ -0,0 +1,29 @@ +From e1f48323a1eb73018e3929eeac65b26eee7207ea Mon Sep 17 00:00:00 2001 +From: Jamie Lennox +Date: Wed, 4 Dec 2019 21:56:45 +1100 +Subject: [PATCH] Use system urllib3 package + +The fedora requests package uses the system urllib3 rather than the one +bundled into requests. requests-mock must therefore do the same thing. +--- + requests_mock/response.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/requests_mock/response.py b/requests_mock/response.py +index d081cf5..13ab2b8 100644 +--- a/requests_mock/response.py ++++ b/requests_mock/response.py +@@ -16,9 +16,9 @@ from requests.adapters import HTTPAdapter + from requests.cookies import MockRequest, MockResponse + from requests.cookies import RequestsCookieJar + from requests.cookies import merge_cookies, cookiejar_from_dict +-from requests.packages.urllib3.response import HTTPResponse + from requests.utils import get_encoding_from_headers + import six ++from urllib3.response import HTTPResponse + + from requests_mock import compat + from requests_mock import exceptions +-- +2.21.0 + diff --git a/0003-Allow-skipping-purl-tests-if-it-is-not-present.patch b/0003-Allow-skipping-purl-tests-if-it-is-not-present.patch new file mode 100644 index 0000000..a001e7b --- /dev/null +++ b/0003-Allow-skipping-purl-tests-if-it-is-not-present.patch @@ -0,0 +1,41 @@ +From b1844f12934f7a1554fdfaf26cb05261d222a1da Mon Sep 17 00:00:00 2001 +From: Jamie Lennox +Date: Wed, 4 Dec 2019 22:16:16 +1100 +Subject: [PATCH] Allow skipping purl tests if it is not present + +Purl is not available in some packaging scenarios, like on fedora. +Easiest to just ignore this one if not present. +--- + tests/test_adapter.py | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/tests/test_adapter.py b/tests/test_adapter.py +index 70d0752..b6aa845 100644 +--- a/tests/test_adapter.py ++++ b/tests/test_adapter.py +@@ -13,7 +13,11 @@ + import json + import re + +-import purl ++try: ++ import purl ++except ImportError: ++ purl = None ++ + import requests + import six + from six.moves.urllib import parse as urlparse +@@ -329,6 +333,9 @@ class SessionAdapterTests(base.TestCase): + self.assertEqual('resp', resp.text) + + def test_with_purl(self): ++ if purl is None: ++ self.skipTest('purl is not present') ++ + self.adapter.register_uri('GET', + purl.URL('mock://www.tester.com/a'), + text='resp') +-- +2.21.0 + diff --git a/python-requests-mock.spec b/python-requests-mock.spec index f3aa759..e4fb6e2 100644 --- a/python-requests-mock.spec +++ b/python-requests-mock.spec @@ -1,85 +1,64 @@ -%global _empty_manifest_terminate_build 0 Name: python-requests-mock -Version: 1.8.0 -Release: 3 -Summary: Mock out responses from the requests package -License: Apache-2 +Version: 1.9.3 +Release: 1 +Summary: A requests mocking tool for python + +License: Apache-2.0 URL: https://github.com/jamielennox/requests-mock -Source0: https://files.pythonhosted.org/packages/45/2d/12f93bd2fd08fa2a77abea6370a6dd2d2dc748fb8d8a4521a8f289bde116/requests-mock-1.8.0.tar.gz +Source0: https://files.pythonhosted.org/packages/71/1e/1680394d9ad02bf7fb34f6e161b6eff62c972f2c1e647389ce2d324b3c25/requests-mock-1.9.3.tar.gz + +Patch0: 0002-Use-system-urllib3-package.patch +Patch1: 0003-Allow-skipping-purl-tests-if-it-is-not-present.patch + BuildArch: noarch -Requires: python3-requests -Requires: python3-six -Requires: python3-fixtures -Requires: python3-fixtures -Requires: python3-mock -Requires: python3-purl -Requires: python3-pytest -Requires: python3-sphinx -Requires: python3-testrepository -Requires: python3-testtools - %description -Mocked responses for the requests library +requests-mock provides a simple way to do HTTP mocking at the +python-requests layer. -%package -n python3-requests-mock -Summary: Mock out responses from the requests package -Provides: python-requests-mock -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-pip -BuildRequires: python3-pbr -%description -n python3-requests-mock -Mocked responses for the requests library +%package -n python%{python3_pkgversion}-requests-mock +Summary: A requests mocking tool for python -%package help -Summary: Development documents and examples for requests-mock -Provides: python3-requests-mock-doc -%description help -Mocked responses for the requests library +Requires: python%{python3_pkgversion}-requests +Requires: python%{python3_pkgversion}-six + +BuildRequires: python%{python3_pkgversion}-requests +BuildRequires: python%{python3_pkgversion}-six +BuildRequires: python%{python3_pkgversion}-urllib3 +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-pbr +BuildRequires: python%{python3_pkgversion}-setuptools + +%description -n python%{python3_pkgversion}-requests-mock +requests-mock provides a simple way to do HTTP mocking at the +python-requests layer. %prep -%autosetup -n requests-mock-1.8.0 +%setup -q -n requests-mock-%{version} +%patch0 -p1 +%patch1 -p1 + +# Remove bundled egg-info +rm -rf requests_mock.egg-info %build %py3_build %install %py3_install -install -d -m755 %{buildroot}/%{_pkgdocdir} -if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi -if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi -if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi -if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi -pushd %{buildroot} -if [ -d usr/lib ]; then - find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst -fi -if [ -d usr/lib64 ]; then - find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst -fi -if [ -d usr/bin ]; then - find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst -fi -if [ -d usr/sbin ]; then - find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst -fi -touch doclist.lst -if [ -d usr/share/man ]; then - find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst -fi -popd -mv %{buildroot}/filelist.lst . -mv %{buildroot}/doclist.lst . -%files -n python3-requests-mock -f filelist.lst -%dir %{python3_sitelib}/* - -%files help -f doclist.lst -%{_docdir}/* +%files -n python%{python3_pkgversion}-requests-mock +%license LICENSE +%doc README.rst ChangeLog +%{python3_sitelib}/requests_mock +%{python3_sitelib}/requests_mock-%{version}-py%{python3_version}.egg-info %changelog +* Tue Jun 07 2022 liukuo - 1.9.3-1 +- Update package version + * Wed Jan 20 2021 zhangy1317 - Add BuildRequires + * Thu Dec 31 2020 Python_Bot - Package Spec generated diff --git a/requests-mock-1.8.0.tar.gz b/requests-mock-1.8.0.tar.gz deleted file mode 100644 index 0f2bd82..0000000 Binary files a/requests-mock-1.8.0.tar.gz and /dev/null differ diff --git a/requests-mock-1.9.3.tar.gz b/requests-mock-1.9.3.tar.gz new file mode 100644 index 0000000..4361231 Binary files /dev/null and b/requests-mock-1.9.3.tar.gz differ