- 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
This commit is contained in:
parent
d6d19686e2
commit
aed3316871
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu May 5 07:53:54 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch remove-mock.patch:
|
||||
* Use unittest.mock in the functional tests.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Mar 12 05:50:55 UTC 2022 - Arun Persaud <arun@gmx.de>
|
||||
|
||||
|
@ -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
|
||||
|
34
remove-mock.patch
Normal file
34
remove-mock.patch
Normal file
@ -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(
|
Loading…
x
Reference in New Issue
Block a user