python-httpretty/remove-mock.patch

35 lines
1.2 KiB
Diff

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(