Created
March 17, 2016 20:05
-
-
Save vortec/cbe72e1f9e01aca96ca6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ py.test tests | |
| ==================================================== test session starts ==================================================== | |
| platform darwin -- Python 3.4.1 -- py-1.4.30 -- pytest-2.7.2 | |
| rootdir: /Users/vortec/workspace/code/hug, inifile: | |
| plugins: cov, xdist, xdist, xdist | |
| collected 356 items | |
| tests/test_api.py .. | |
| tests/test_authentication.py ... | |
| tests/test_decorators.py ............................................................... | |
| tests/test_directives.py ............. | |
| tests/test_documentation.py . | |
| tests/test_exceptions.py . | |
| tests/test_input_format.py ... | |
| tests/test_introspect.py ....... | |
| tests/test_middleware.py .. | |
| tests/test_output_format.py ............ | |
| tests/test_redirect.py ...... | |
| tests/test_route.py ........... | |
| tests/test_routing.py ........................................................................................................................................................................ | |
| tests/test_store.py . | |
| tests/test_transform.py .... | |
| tests/test_types.py ............................... | |
| tests/test_use.py .......................FF | |
| tests/test_validate.py ... | |
| ========================================================= FAILURES ========================================================== | |
| __________________________________________________ TestSocket.test_request __________________________________________________ | |
| self = <tests.test_use.TestSocket object at 0x1115e2978> | |
| def test_request(self): | |
| """Test to ensure requesting data from a socket service works as expected""" | |
| > data = self.tcp_service.request(message='GET / HTTP/1.0\r\n\r\n', timeout=30).data.read() | |
| tests/test_use.py:182: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <hug.use.Socket object at 0x1115743a8>, message = 'GET / HTTP/1.0\r\n\r\n', timeout = 30, args = (), kwargs = {} | |
| _socket = <socket.socket fd=17, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('192.168.2.100', 50549), raddr=('153.104.63.227', 80)> | |
| data = <_io.BytesIO object at 0x1113f4ac8> | |
| def request(self, message, timeout=False, *args, **kwargs): | |
| """Populate connection pool, send message, return BytesIO, and cleanup""" | |
| if not self.connection_pool.full(): | |
| self.connection_pool.put(self._register_socket()) | |
| _socket = self.connection_pool.get() | |
| # setting timeout to None enables the socket to block. | |
| if timeout or timeout is None: | |
| _socket.settimeout(timeout) | |
| data = self.send_and_receive(_socket, message, *args, **kwargs) | |
| if self.connection.proto in Socket.streams: | |
| > _socket.shutdown(socket.SHUT_RDWR) | |
| E OSError: [Errno 57] Socket is not connected | |
| hug/use.py:256: OSError | |
| _____________________________________________ TestSocket.test_datagram_request ______________________________________________ | |
| self = <tests.test_use.TestSocket object at 0x1114b5f28> | |
| def test_datagram_request(self): | |
| """Test to ensure requesting data from a socket service works as expected""" | |
| packet = struct.pack("!HHHHHH", 0x0001, 0x0100, 1, 0, 0, 0) | |
| for name in ('www', 'google', 'com'): | |
| header = b"!b" | |
| header += bytes(str(len(name)), "utf-8") + b"s" | |
| query = struct.pack(header, len(name), name.encode('utf-8')) | |
| packet = packet + query | |
| dns_query = packet + struct.pack("!bHH", 0, 1, 1) | |
| > assert len(self.udp_service.request(dns_query.decode("utf-8"), buffer_size=4096).data.read()) > 0 | |
| tests/test_use.py:195: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| hug/use.py:253: in request | |
| data = self.send_and_receive(_socket, message, *args, **kwargs) | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <hug.use.Socket object at 0x1115749a8> | |
| _socket = <socket.socket fd=18, family=AddressFamily.AF_INET, type=SocketType.SOCK_DGRAM, proto=0, laddr=('192.168.2.100', 58971), raddr=('8.8.8.8', 53)> | |
| message = '\x00\x01\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03www\x06google\x03com\x00\x00\x01\x00\x01', buffer_size = 4096 | |
| args = () | |
| def _dgram_send_and_receive(self, _socket, message, buffer_size=4096, *args): | |
| """User Datagram Protocol sender and receiver""" | |
| > _socket.sendto(message.encode('utf-8'), self.connection.connect_to) | |
| E OSError: [Errno 56] Socket is already connected | |
| hug/use.py:238: OSError | |
| =========================================== 2 failed, 354 passed in 13.25 seconds =========================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment