- Add patch remove-mock.patch:

* Use unittest.mock if available.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests-mock?expand=0&rev=47
This commit is contained in:
Steve Kowalik 2022-07-22 11:15:57 +00:00 committed by Git OBS Bridge
parent 302dec0b03
commit bd05a5217c
3 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jul 22 11:15:27 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch remove-mock.patch:
* Use unittest.mock if available.
-------------------------------------------------------------------
Sun Jun 6 11:58:05 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-requests-mock
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,11 +22,10 @@ Version: 1.9.3
Release: 0
Summary: Module to mock out responses from the requests package
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/jamielennox/requests-mock
Source: https://files.pythonhosted.org/packages/source/r/requests-mock/requests-mock-%{version}.tar.gz
Patch0: remove-mock.patch
BuildRequires: %{python_module fixtures}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pbr}
BuildRequires: %{python_module purl}
BuildRequires: %{python_module purl}
@ -55,7 +54,7 @@ requests-mock provides a building block to stub out the HTTP requests portions o
You should checkout the docs for more information.
%prep
%setup -q -n requests-mock-%{version}
%autosetup -p1 -n requests-mock-%{version}
%build
%python_build

16
remove-mock.patch Normal file
View File

@ -0,0 +1,16 @@
Index: requests-mock-1.9.3/tests/test_mocker.py
===================================================================
--- requests-mock-1.9.3.orig/tests/test_mocker.py
+++ requests-mock-1.9.3/tests/test_mocker.py
@@ -12,7 +12,10 @@
import pickle
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import requests
import requests_mock