From aed33168715dba1e5a29207d0f0953d8ecc7b915e2a805c2ddcfdb11ba683a43 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 5 May 2022 07:54:38 +0000 Subject: [PATCH] - Add patch remove-mock.patch: * Use unittest.mock in the functional tests. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httpretty?expand=0&rev=45 --- python-httpretty.changes | 6 ++++++ python-httpretty.spec | 4 ++-- remove-mock.patch | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 remove-mock.patch diff --git a/python-httpretty.changes b/python-httpretty.changes index 5415eb5..dd6d288 100644 --- a/python-httpretty.changes +++ b/python-httpretty.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu May 5 07:53:54 UTC 2022 - Steve Kowalik + +- Add patch remove-mock.patch: + * Use unittest.mock in the functional tests. + ------------------------------------------------------------------- Sat Mar 12 05:50:55 UTC 2022 - Arun Persaud diff --git a/python-httpretty.spec b/python-httpretty.spec index 858c391..76cafc7 100644 --- a/python-httpretty.spec +++ b/python-httpretty.spec @@ -23,9 +23,9 @@ Version: 1.1.4 Release: 0 Summary: HTTP client mocking tool for Python License: MIT -Group: Development/Languages/Python URL: https://github.com/gabrielfalcao/HTTPretty Source: https://files.pythonhosted.org/packages/source/h/httpretty/httpretty-%{version}.tar.gz +Patch0: remove-mock.patch BuildRequires: %{python_module eventlet} BuildRequires: %{python_module fakeredis} BuildRequires: %{python_module freezegun} @@ -46,7 +46,7 @@ unit tests. It is similar to Ruby's FakeWeb. %prep -%setup -q -n httpretty-%{version} +%autosetup -p1 -n httpretty-%{version} # no test coverage check needed sed -i -e '/cover/ d' setup.cfg # no color printout for tests diff --git a/remove-mock.patch b/remove-mock.patch new file mode 100644 index 0000000..a79ba6a --- /dev/null +++ b/remove-mock.patch @@ -0,0 +1,34 @@ +Index: httpretty-1.1.4/tests/functional/test_fakesocket.py +=================================================================== +--- httpretty-1.1.4.orig/tests/functional/test_fakesocket.py ++++ httpretty-1.1.4/tests/functional/test_fakesocket.py +@@ -28,7 +28,10 @@ + import functools + import socket + +-import mock ++try: ++ from unittest.mock import patch ++except ImportError: ++ from mock import patch + + + class FakeSocket(socket.socket): +@@ -60,7 +63,7 @@ def recv(flag, size): + recv = functools.partial(recv, fake_socket_interupter_flag) + + +-@mock.patch('httpretty.old_socket', new=FakeSocket) ++@patch('httpretty.old_socket', new=FakeSocket) + def _test_shorten_response(): + u"HTTPretty shouldn't try to read from server when communication is over" + from sure import expect +@@ -68,7 +71,7 @@ def _test_shorten_response(): + + fakesocket = httpretty.fakesock.socket(socket.AF_INET, + socket.SOCK_STREAM) +- with mock.patch.object(fakesocket.truesock, 'recv', recv): ++ with patch.object(fakesocket.truesock, 'recv', recv): + fakesocket.connect(('localhost', 80)) + fakesocket._true_sendall('WHATEVER') + expect(fakesocket.fd.read()).to.equal(