Hello community, here is the log from the commit of package python-httpretty for openSUSE:Factory checked in at 2015-04-23 08:04:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-httpretty (Old) and /work/SRC/openSUSE:Factory/.python-httpretty.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-httpretty" Changes: -------- --- /work/SRC/openSUSE:Factory/python-httpretty/python-httpretty.changes 2014-07-31 21:51:10.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-httpretty.new/python-httpretty.changes 2015-04-23 08:04:26.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Apr 22 08:43:41 UTC 2015 - mci...@suse.cz + +- Update to 0.8.8: + * many changes + +------------------------------------------------------------------- Old: ---- httpretty-0.8.3.tar.gz New: ---- httpretty-0.8.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-httpretty.spec ++++++ --- /var/tmp/diff_new_pack.Q4Wz5V/_old 2015-04-23 08:04:26.000000000 +0200 +++ /var/tmp/diff_new_pack.Q4Wz5V/_new 2015-04-23 08:04:26.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-httpretty # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-httpretty -Version: 0.8.3 +Version: 0.8.8 Release: 0 Summary: HTTP client mock for Python License: MIT ++++++ httpretty-0.8.3.tar.gz -> httpretty-0.8.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/Makefile new/httpretty-0.8.8/Makefile --- old/httpretty-0.8.3/Makefile 2014-06-19 22:37:15.000000000 +0200 +++ new/httpretty-0.8.8/Makefile 2015-02-21 16:41:28.000000000 +0100 @@ -33,7 +33,7 @@ release: clean unit functional @echo "Releasing httpretty..." @./.release - @python setup.py sdist register upload + @python setup.py sdist bdist_wheel register upload docs: doctests @pandoc -o README.rst README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/PKG-INFO new/httpretty-0.8.8/PKG-INFO --- old/httpretty-0.8.3/PKG-INFO 2014-06-19 22:37:28.000000000 +0200 +++ new/httpretty-0.8.8/PKG-INFO 2015-03-11 17:48:41.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: httpretty -Version: 0.8.3 +Version: 0.8.8 Summary: HTTP client mock for Python Home-page: http://github.com/gabrielfalcao/httpretty Author: Gabriel Falcao diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/README.md new/httpretty-0.8.8/README.md --- old/httpretty-0.8.3/README.md 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/README.md 2015-03-11 17:48:41.000000000 +0100 @@ -1,4 +1,4 @@ -# HTTPretty 0.8.3 +# HTTPretty 0.8.8 ![https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg](https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg) [![tip for next commit](http://tip4commit.com/projects/133.svg)](http://tip4commit.com/projects/133) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/dev-requirements.txt new/httpretty-0.8.8/dev-requirements.txt --- old/httpretty-0.8.3/dev-requirements.txt 2014-06-19 21:58:10.000000000 +0200 +++ new/httpretty-0.8.8/dev-requirements.txt 2015-02-03 22:30:28.000000000 +0100 @@ -1,2 +1,9 @@ +-r requirements.txt +coverage +tox markment steadymark +nose +rednose +mock +sure \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty/__init__.py new/httpretty-0.8.8/httpretty/__init__.py --- old/httpretty-0.8.3/httpretty/__init__.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/httpretty/__init__.py 2015-03-11 17:48:41.000000000 +0100 @@ -25,10 +25,10 @@ # OTHER DEALINGS IN THE SOFTWARE. from __future__ import unicode_literals -__version__ = version = '0.8.3' +__version__ = version = '0.8.8' from .core import httpretty, httprettified -from .errors import HTTPrettyError +from .errors import HTTPrettyError, UnmockedError from .core import URIInfo HTTPretty = httpretty diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty/core.py new/httpretty-0.8.8/httpretty/core.py --- old/httpretty-0.8.3/httpretty/core.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/httpretty/core.py 2015-03-11 17:48:41.000000000 +0100 @@ -66,7 +66,7 @@ decode_utf8, ) -from .errors import HTTPrettyError +from .errors import HTTPrettyError, UnmockedError from datetime import datetime from datetime import timedelta @@ -160,7 +160,8 @@ self.error_message = None # Parse the request based on the attributes above - self.parse_request() + if not self.parse_request(): + return # making the HTTP method string available as the command self.method = self.command @@ -172,6 +173,7 @@ self.path = self.path.encode('iso-8859-1') except UnicodeDecodeError: pass + self.path = decode_utf8(self.path) qstring = self.path.split("?", 1)[-1] @@ -227,7 +229,9 @@ class FakeSockFile(StringIO): - pass + def close(self): + self.socket.close() + StringIO.close(self) class FakeSSLSocket(object): @@ -246,14 +250,16 @@ def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, protocol=0): - self.setsockopt(family, type, protocol) - self.truesock = old_socket(family, type, protocol) + self.truesock = (old_socket(family, type, protocol) + if httpretty.allow_net_connect + else None) self._closed = True self.fd = FakeSockFile() + self.fd.socket = self self.timeout = socket._GLOBAL_DEFAULT_TIMEOUT self._sock = self self.is_http = False - self._bufsize = 16 + self._bufsize = 1024 def getpeercert(self, *a, **kw): now = datetime.now() @@ -282,22 +288,34 @@ def ssl(self, sock, *args, **kw): return sock - def setsockopt(self, family, type, protocol): - self.family = family - self.protocol = protocol - self.type = type + def setsockopt(self, level, optname, value): + if self.truesock: + self.truesock.setsockopt(level, optname, value) def connect(self, address): - self._address = (self._host, self._port) = address self._closed = False - self.is_http = self._port in POTENTIAL_HTTP_PORTS | POTENTIAL_HTTPS_PORTS + + try: + self._address = (self._host, self._port) = address + except ValueError: + # We get here when the address is just a string pointing to a + # unix socket path/file + # + # See issue #206 + self.is_http = False + else: + self.is_http = self._port in POTENTIAL_HTTP_PORTS | POTENTIAL_HTTPS_PORTS if not self.is_http: - self.truesock.connect(self._address) + if self.truesock: + self.truesock.connect(self._address) + else: + raise UnmockedError() def close(self): - if not (self.is_http and self._closed): - self.truesock.close() + if not self.is_http and not self._closed: + if self.truesock: + self.truesock.close() self._closed = True def makefile(self, mode='r', bufsize=-1): @@ -324,12 +342,16 @@ buffer so that HTTPretty can return it accordingly when necessary. """ - if self.is_http: # no need to connect if `self.is_http` is - # False because self.connect already did - # that - self.truesock.connect(self._address) - self.truesock.settimeout(0) + if not self.truesock: + raise UnmockedError() + + if not self.is_http: + return self.truesock.sendall(data, *args, **kw) + + self.truesock.connect(self._address) + + self.truesock.setblocking(1) self.truesock.sendall(data, *args, **kw) should_continue = True @@ -337,7 +359,7 @@ try: received = self.truesock.recv(self._bufsize) self.fd.write(received) - should_continue = len(received) > 0 + should_continue = len(received) == self._bufsize except socket.error as e: if e.errno == EAGAIN: @@ -348,7 +370,8 @@ def sendall(self, data, *args, **kw): self._sent_data.append(data) - + self.fd = FakeSockFile() + self.fd.socket = self try: requestline, _ = data.split(b'\r\n', 1) method, path, version = parse_requestline(decode_utf8(requestline)) @@ -397,7 +420,7 @@ self._entry = matcher.get_next_entry(method, info, request) - def debug(self, func, *a, **kw): + def debug(self, truesock_func, *a, **kw): if self.is_http: frame = inspect.stack()[0][0] lines = list(map(utf8, traceback.format_stack(frame))) @@ -410,30 +433,34 @@ "".join(decode_utf8(lines)), ] raise RuntimeError("\n".join(message)) - return func(*a, **kw) + if not self.truesock: + raise UnmockedError() + return getattr(self.truesock, truesock_func)(*a, **kw) def settimeout(self, new_timeout): self.timeout = new_timeout def send(self, *args, **kwargs): - return self.debug(self.truesock.send, *args, **kwargs) + return self.debug('send', *args, **kwargs) def sendto(self, *args, **kwargs): - return self.debug(self.truesock.sendto, *args, **kwargs) + return self.debug('sendto', *args, **kwargs) def recvfrom_into(self, *args, **kwargs): - return self.debug(self.truesock.recvfrom_into, *args, **kwargs) + return self.debug('recvfrom_into', *args, **kwargs) def recv_into(self, *args, **kwargs): - return self.debug(self.truesock.recv_into, *args, **kwargs) + return self.debug('recv_into', *args, **kwargs) def recvfrom(self, *args, **kwargs): - return self.debug(self.truesock.recvfrom, *args, **kwargs) + return self.debug('recvfrom', *args, **kwargs) def recv(self, *args, **kwargs): - return self.debug(self.truesock.recv, *args, **kwargs) + return self.debug('recv', *args, **kwargs) def __getattr__(self, name): + if not self.truesock: + raise UnmockedError() return getattr(self.truesock, name) @@ -797,6 +824,7 @@ last_request = HTTPrettyRequestEmpty() _is_enabled = False + allow_net_connect = True @classmethod def match_uriinfo(cls, info): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty/errors.py new/httpretty-0.8.8/httpretty/errors.py --- old/httpretty-0.8.3/httpretty/errors.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/httpretty/errors.py 2015-03-11 17:48:41.000000000 +0100 @@ -29,3 +29,11 @@ class HTTPrettyError(Exception): pass + + +class UnmockedError(HTTPrettyError): + def __init__(self): + super(UnmockedError, self).__init__( + 'No mocking was registered, and real connections are ' + 'not allowed (httpretty.allow_net_connect = False).' + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty/utils.py new/httpretty-0.8.8/httpretty/utils.py --- old/httpretty-0.8.3/httpretty/utils.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/httpretty/utils.py 2015-03-11 17:48:41.000000000 +0100 @@ -33,6 +33,8 @@ def utf8(s): if isinstance(s, text_type): s = s.encode('utf-8') + elif s is None: + return byte_type() return byte_type(s) @@ -40,5 +42,7 @@ def decode_utf8(s): if isinstance(s, byte_type): s = s.decode("utf-8") + elif s is None: + return text_type() return text_type(s) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty.egg-info/PKG-INFO new/httpretty-0.8.8/httpretty.egg-info/PKG-INFO --- old/httpretty-0.8.3/httpretty.egg-info/PKG-INFO 2014-06-19 22:37:28.000000000 +0200 +++ new/httpretty-0.8.8/httpretty.egg-info/PKG-INFO 2015-03-11 17:48:41.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: httpretty -Version: 0.8.3 +Version: 0.8.8 Summary: HTTP client mock for Python Home-page: http://github.com/gabrielfalcao/httpretty Author: Gabriel Falcao diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty.egg-info/SOURCES.txt new/httpretty-0.8.8/httpretty.egg-info/SOURCES.txt --- old/httpretty-0.8.3/httpretty.egg-info/SOURCES.txt 2014-06-19 22:37:28.000000000 +0200 +++ new/httpretty-0.8.8/httpretty.egg-info/SOURCES.txt 2015-03-11 17:48:41.000000000 +0100 @@ -19,7 +19,6 @@ httpretty.egg-info/SOURCES.txt httpretty.egg-info/dependency_links.txt httpretty.egg-info/not-zip-safe -httpretty.egg-info/requires.txt httpretty.egg-info/top_level.txt tests/__init__.py tests/functional/__init__.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/httpretty.egg-info/requires.txt new/httpretty-0.8.8/httpretty.egg-info/requires.txt --- old/httpretty-0.8.3/httpretty.egg-info/requires.txt 2014-06-19 22:37:28.000000000 +0200 +++ new/httpretty-0.8.8/httpretty.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -urllib3==1.7.1 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/requirements.txt new/httpretty-0.8.8/requirements.txt --- old/httpretty-0.8.3/requirements.txt 2014-06-19 21:58:10.000000000 +0200 +++ new/httpretty-0.8.8/requirements.txt 2015-02-21 16:41:28.000000000 +0100 @@ -1 +0,0 @@ -urllib3==1.7.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/test-requirements.txt new/httpretty-0.8.8/test-requirements.txt --- old/httpretty-0.8.3/test-requirements.txt 2014-06-19 21:58:10.000000000 +0200 +++ new/httpretty-0.8.8/test-requirements.txt 2015-02-21 16:41:28.000000000 +0100 @@ -1,3 +1,8 @@ +httplib2==0.9 +requests==2.5.1 +tornado==4.0.2 +urllib3==1.7.1 + # test runner coverage==3.7.1 nose==1.3.0 @@ -5,8 +10,3 @@ # testing utilities mock==1.0.1 sure==1.2.3 - -# external frameworks tested against -httplib2==0.8 -requests -tornado==3.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/tests/functional/test_bypass.py new/httpretty-0.8.8/tests/functional/test_bypass.py --- old/httpretty-0.8.3/tests/functional/test_bypass.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/tests/functional/test_bypass.py 2015-03-11 17:48:41.000000000 +0100 @@ -34,8 +34,10 @@ from .testserver import TornadoServer, TCPServer, TCPClient from sure import expect, that_with_context +import functools + import httpretty -from httpretty import core +from httpretty import core, HTTPretty def start_http_server(context): @@ -134,3 +136,68 @@ expect(got1).to.equal(b'BAR') expect(context.client.send("foobar")).to.equal(b"RECEIVED: foobar") + + +def disallow_net_connect(test): + @functools.wraps(test) + def wrapper(*args, **kwargs): + HTTPretty.allow_net_connect = False + try: + return test(*args, **kwargs) + finally: + HTTPretty.allow_net_connect = True + return wrapper + + +@disallow_net_connect +@httpretty.activate +@that_with_context(start_http_server, stop_http_server) +def test_disallow_net_connect_1(context): + """ + When allow_net_connect = False, a request that otherwise + would have worked results in UnmockedError. + """ + httpretty.register_uri(httpretty.GET, "http://falcao.it/foo/", + body="BAR") + + def foo(): + fd = None + try: + fd = urllib2.urlopen('http://localhost:9999/go-for-bubbles/') + finally: + if fd: + fd.close() + + foo.should.throw(httpretty.UnmockedError) + + +@disallow_net_connect +@httpretty.activate +def test_disallow_net_connect_2(): + """ + When allow_net_connect = False, a request that would have + failed results in UnmockedError. + """ + + def foo(): + fd = None + try: + fd = urllib2.urlopen('http://example.com/nonsense') + finally: + if fd: + fd.close() + + foo.should.throw(httpretty.UnmockedError) + + +@disallow_net_connect +@httpretty.activate +def test_disallow_net_connect_3(): + "When allow_net_connect = False, mocked requests still work correctly." + + httpretty.register_uri(httpretty.GET, "http://falcao.it/foo/", + body="BAR") + fd = urllib2.urlopen('http://falcao.it/foo/') + got1 = fd.read() + fd.close() + expect(got1).to.equal(b'BAR') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/tests/unit/test_core.py new/httpretty-0.8.8/tests/unit/test_core.py --- old/httpretty-0.8.3/tests/unit/test_core.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/tests/unit/test_core.py 2015-03-11 17:48:41.000000000 +0100 @@ -299,6 +299,37 @@ @patch('httpretty.core.old_socket') def test_fakesock_socket_real_sendall(old_socket): + ("fakesock.socket#real_sendall calls truesock#connect and bails " + "out when not http") + # Background: the real socket will stop returning bytes after the + # first call + real_socket = old_socket.return_value + real_socket.recv.side_effect = [b'response from server', b""] + + # Given a fake socket + socket = fakesock.socket() + + # When I call real_sendall with data, some args and kwargs + socket.real_sendall(b"SOMEDATA", b'some extra args...', foo=b'bar') + + # Then it should have called sendall in the real socket + real_socket.sendall.assert_called_once_with(b"SOMEDATA", b'some extra args...', foo=b'bar') + + # And setblocking was never called + real_socket.setblocking.called.should.be.false + + # And recv was never called + real_socket.recv.called.should.be.false + + # And the buffer is empty + socket.fd.getvalue().should.equal(b'') + + # And connect was never called + real_socket.connect.called.should.be.false + + +@patch('httpretty.core.old_socket') +def test_fakesock_socket_real_sendall_when_http(old_socket): ("fakesock.socket#real_sendall sends data and buffers " "the response in the file descriptor") # Background: the real socket will stop returning bytes after the @@ -308,6 +339,7 @@ # Given a fake socket socket = fakesock.socket() + socket.is_http = True # When I call real_sendall with data, some args and kwargs socket.real_sendall(b"SOMEDATA", b'some extra args...', foo=b'bar') @@ -315,25 +347,24 @@ # Then it should have called sendall in the real socket real_socket.sendall.assert_called_once_with(b"SOMEDATA", b'some extra args...', foo=b'bar') - # And the timeout was set to 0 - real_socket.settimeout.assert_called_once_with(0) + # And the socket was set to blocking + real_socket.setblocking.assert_called_once_with(1) # And recv was called with the bufsize real_socket.recv.assert_has_calls([ - call(16), - call(16), + call(socket._bufsize) ]) # And the buffer should contain the data from the server socket.fd.getvalue().should.equal(b"response from server") - # And connect was never called - real_socket.connect.called.should.be.false + # And connect was called + real_socket.connect.called.should.be.true @patch('httpretty.core.old_socket') @patch('httpretty.core.socket') -def test_fakesock_socket_real_sendall_continue_eagain(socket, old_socket): +def test_fakesock_socket_real_sendall_continue_eagain_when_http(socket, old_socket): ("fakesock.socket#real_sendall should continue if the socket error was EAGAIN") socket.error = SocketErrorStub # Background: the real socket will stop returning bytes after the @@ -343,7 +374,7 @@ # Given a fake socket socket = fakesock.socket() - + socket.is_http = True # When I call real_sendall with data, some args and kwargs socket.real_sendall(b"SOMEDATA", b'some extra args...', foo=b'bar') @@ -351,25 +382,24 @@ # Then it should have called sendall in the real socket real_socket.sendall.assert_called_once_with(b"SOMEDATA", b'some extra args...', foo=b'bar') - # And the timeout was set to 0 - real_socket.settimeout.assert_called_once_with(0) + # And the socket was set to blocking + real_socket.setblocking.assert_called_once_with(1) # And recv was called with the bufsize real_socket.recv.assert_has_calls([ - call(16), - call(16), + call(socket._bufsize) ]) # And the buffer should contain the data from the server socket.fd.getvalue().should.equal(b"after error") - # And connect was never called - real_socket.connect.called.should.be.false + # And connect was called + real_socket.connect.called.should.be.true @patch('httpretty.core.old_socket') @patch('httpretty.core.socket') -def test_fakesock_socket_real_sendall_socket_error(socket, old_socket): +def test_fakesock_socket_real_sendall_socket_error_when_http(socket, old_socket): ("fakesock.socket#real_sendall should continue if the socket error was EAGAIN") socket.error = SocketErrorStub # Background: the real socket will stop returning bytes after the @@ -379,6 +409,7 @@ # Given a fake socket socket = fakesock.socket() + socket.is_http = True # When I call real_sendall with data, some args and kwargs socket.real_sendall(b"SOMEDATA", b'some extra args...', foo=b'bar') @@ -386,17 +417,17 @@ # Then it should have called sendall in the real socket real_socket.sendall.assert_called_once_with(b"SOMEDATA", b'some extra args...', foo=b'bar') - # And the timeout was set to 0 - real_socket.settimeout.assert_called_once_with(0) + # And the socket was set to blocking + real_socket.setblocking.assert_called_once_with(1) # And recv was called with the bufsize - real_socket.recv.assert_called_once_with(16) + real_socket.recv.assert_called_once_with(socket._bufsize) # And the buffer should contain the data from the server socket.fd.getvalue().should.equal(b"") - # And connect was never called - real_socket.connect.called.should.be.false + # And connect was called + real_socket.connect.called.should.be.true @patch('httpretty.core.old_socket') @@ -410,6 +441,7 @@ # And the potential http port is 4000 POTENTIAL_HTTP_PORTS.__contains__.side_effect = lambda other: int(other) == 4000 + POTENTIAL_HTTP_PORTS.__or__.side_effect = lambda other: POTENTIAL_HTTP_PORTS # Given a fake socket socket = fakesock.socket() @@ -423,13 +455,12 @@ # Then connect should have been called real_socket.connect.assert_called_once_with(('foobar.com', 4000)) - # And the timeout was set to 0 - real_socket.settimeout.assert_called_once_with(0) + # And the socket was set to blocking + real_socket.setblocking.assert_called_once_with(1) # And recv was called with the bufsize real_socket.recv.assert_has_calls([ - call(16), - call(16), + call(socket._bufsize) ]) # And the buffer should contain the data from the server diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/tests/unit/test_httpretty.py new/httpretty-0.8.8/tests/unit/test_httpretty.py --- old/httpretty-0.8.3/tests/unit/test_httpretty.py 2014-06-19 22:37:27.000000000 +0200 +++ new/httpretty-0.8.8/tests/unit/test_httpretty.py 2015-03-11 17:48:41.000000000 +0100 @@ -353,6 +353,18 @@ expect(s.shutdown).called_with(socket.SHUT_RD).should_not.throw(AttributeError) s.truesock.shutdown.assert_called_with(socket.SHUT_RD) +def test_unix_socket(): + import socket + HTTPretty.enable() + + # Create a UDS socket + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + server_address = './not-exist-socket' + try: + sock.connect(server_address) + except socket.error: + # We expect this, since the server_address does not exist + pass def test_HTTPrettyRequest_json_body(): """ A content-type of application/json should parse a valid json body """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/httpretty-0.8.3/tox.ini new/httpretty-0.8.8/tox.ini --- old/httpretty-0.8.3/tox.ini 2014-06-19 21:58:10.000000000 +0200 +++ new/httpretty-0.8.8/tox.ini 2015-02-12 22:39:24.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27 +envlist = py26, py27, py34 [testenv] deps = -r{toxinidir}/test-requirements.txt