[packages/python-requests-mock] - updated to 1.8.0 - pl - added mock patch (don't require python3-mock module, use unittest.mock ins
qboosh
qboosh at pld-linux.org
Sat Jan 23 08:15:00 CET 2021
commit 4eaa4b3cb95f33a653bd34ae103687810134411a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Jan 23 08:14:54 2021 +0100
- updated to 1.8.0
- pl
- added mock patch (don't require python3-mock module, use unittest.mock instead); enabled tests by default
- added no-git patch (don't require git repository), build apidocs
python-requests-mock-mock.patch | 14 ++++++
python-requests-mock-no-git.patch | 11 +++++
python-requests-mock.spec | 101 +++++++++++++++++++++++++++++++++-----
3 files changed, 114 insertions(+), 12 deletions(-)
---
diff --git a/python-requests-mock.spec b/python-requests-mock.spec
index b3bad4f..9475f4a 100644
--- a/python-requests-mock.spec
+++ b/python-requests-mock.spec
@@ -1,6 +1,7 @@
#
# Conditional build:
-%bcond_with tests # do not perform "make test"
+%bcond_without doc # API documentation
+%bcond_without tests # unit tests
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
@@ -8,27 +9,53 @@
%define egg_name %{module}
%define pypi_name requests-mock
Summary: Mock out responses from the requests package
+Summary(pl.UTF-8): Podstawianie atrap odpowiedzi z pakietu requests
Name: python-%{pypi_name}
-Version: 1.3.0
-Release: 4
-License: Apache
+Version: 1.8.0
+Release: 1
+License: Apache v2.0
Group: Libraries/Python
-Source0: https://files.pythonhosted.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
-# Source0-md5: d2efbaf16d19153b7d271628071b4d4b
-URL: https://requests-mock.readthedocs.io
+#Source0Download: https://pypi.org/simple/requests-mock/
+Source0: https://files.pythonhosted.org/packages/source/r/requests-mock/%{pypi_name}-%{version}.tar.gz
+# Source0-md5: f09403c1d05ae2d3a72cac6aeb74c40d
+Patch0: %{name}-mock.patch
+Patch1: %{name}-no-git.patch
+URL: https://requests-mock.readthedocs.io/
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
%if %{with python2}
BuildRequires: python-modules
BuildRequires: python-pbr
BuildRequires: python-setuptools
+%if %{with tests}
+BuildRequires: python-fixtures
+BuildRequires: python-mock
+BuildRequires: python-purl
+BuildRequires: python-pytest
+BuildRequires: python-requests >= 2.3
+BuildRequires: python-six
+BuildRequires: python-testrepository >= 0.0.18
+BuildRequires: python-testtools
+%endif
%endif
%if %{with python3}
BuildRequires: python3-modules
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-fixtures
+BuildRequires: python3-purl
+BuildRequires: python3-pytest
+BuildRequires: python3-requests >= 2.3
+BuildRequires: python3-six
+BuildRequires: python3-testrepository >= 0.0.18
+BuildRequires: python3-testtools
+%endif
+%endif
+%if %{with doc}
+BuildRequires: python3-reno
+BuildRequires: sphinx-pdg-3
%endif
-Requires: python-requests
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -36,8 +63,13 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
requests-mock provides a building block to stub out the HTTP requests
portions of your testing code.
+%description -l pl.UTF-8
+Pakiet requests-mock udostępnia blok do tworzenia zaślepek żądań HTTP
+w kodzie testowym.
+
%package -n python3-%{pypi_name}
Summary: Mock out responses from the requests package
+Summary(pl.UTF-8): Podstawianie atrap odpowiedzi z pakietu requests
Group: Libraries/Python
Requires: python3-modules
@@ -45,16 +77,47 @@ Requires: python3-modules
requests-mock provides a building block to stub out the HTTP requests
portions of your testing code.
+%description -n python3-%{pypi_name} -l pl.UTF-8
+Pakiet requests-mock udostępnia blok do tworzenia zaślepek żądań HTTP
+w kodzie testowym.
+
+%package apidocs
+Summary: API documentation for requests_mock module
+Summary(pl.UTF-8): Dokumentacja API modułu requests_mock
+Group: Documentation
+
+%description apidocs
+API documentation for requests_mock module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu requests_mock.
+
%prep
%setup -q -n %{pypi_name}-%{version}
+%patch0 -p1
+%patch1 -p1
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd) \
+%{__python} -m pytest tests/pytest
+
+%{__python} -m subunit.run discover | subunit2pyunit-2
+%endif
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd) \
+%{__python3} -m pytest tests/pytest
+
+%{__python3} -m subunit.run discover | subunit2pyunit-3
+%endif
%endif
%install
@@ -70,13 +133,21 @@ rm -rf $RPM_BUILD_ROOT
%py3_install
%endif
+%if %{with doc}
+#%{__make} -C doc html \
+# SPHINXBUILD=sphinx-build-3
+# broken Makefile (specifies . instead of "source" as source dir), so invoke directly:
+PYTHONPATH=$(pwd) \
+sphinx-build-3 -b html doc/source doc/_build/html
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc AUTHORS ChangeLog README.rst *.txt
+%doc AUTHORS ChangeLog README.rst
%{py_sitescriptdir}/%{module}
%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%endif
@@ -84,7 +155,13 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python3}
%files -n python3-%{pypi_name}
%defattr(644,root,root,755)
-%doc AUTHORS ChangeLog README.rst *.txt
+%doc AUTHORS ChangeLog README.rst
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc doc/_build/html/{_static,*.html,*.js}
+%endif
diff --git a/python-requests-mock-mock.patch b/python-requests-mock-mock.patch
new file mode 100644
index 0000000..6a6fcad
--- /dev/null
+++ b/python-requests-mock-mock.patch
@@ -0,0 +1,14 @@
+--- requests-mock-1.8.0/tests/test_mocker.py.orig 2020-05-02 15:10:34.000000000 +0200
++++ requests-mock-1.8.0/tests/test_mocker.py 2021-01-22 21:32:19.031749242 +0100
+@@ -12,7 +12,10 @@
+
+ import pickle
+
+-import mock
++try:
++ import mock
++except ImportError:
++ from unittest import mock
+ import requests
+
+ import requests_mock
diff --git a/python-requests-mock-no-git.patch b/python-requests-mock-no-git.patch
new file mode 100644
index 0000000..41859d0
--- /dev/null
+++ b/python-requests-mock-no-git.patch
@@ -0,0 +1,11 @@
+--- requests-mock-1.8.0/doc/source/conf.py.orig 2020-05-02 15:10:34.000000000 +0200
++++ requests-mock-1.8.0/doc/source/conf.py 2021-01-22 22:41:44.812514604 +0100
+@@ -27,7 +27,7 @@
+
+ # Add any Sphinx extension module names here, as strings. They can be
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+-extensions = ['reno.sphinxext',
++extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.viewcode',
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-requests-mock.git/commitdiff/4eaa4b3cb95f33a653bd34ae103687810134411a
More information about the pld-cvs-commit
mailing list