* Package: dev-python/jaraco-stream-3.0.2 * Repository: gentoo * Maintainer: sbraz@gentoo.org * Upstream: https://github.com/jaraco/jaraco.stream/issues * USE: abi_x86_64 amd64 elibc_glibc kernel_linux python_targets_python3_7 python_targets_python3_8 python_targets_python3_9 test userland_GNU * FEATURES: network-sandbox preserve-libs sandbox test userpriv usersandbox >>> Unpacking source... >>> Unpacking jaraco.stream-3.0.2.tar.gz to /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work >>> Source unpacked in /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work >>> Preparing source in /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2 ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2 ... * python3_7: running distutils-r1_run_phase distutils-r1_python_compile python3.7 setup.py build -j 9 running build running build_py package init file 'jaraco/__init__.py' not found (or not a regular file) creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream copying jaraco/stream/__init__.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream copying jaraco/stream/gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream copying jaraco/stream/buffer.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream copying jaraco/stream/test_gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream running egg_info writing jaraco.stream.egg-info/PKG-INFO writing dependency_links to jaraco.stream.egg-info/dependency_links.txt writing requirements to jaraco.stream.egg-info/requires.txt writing top-level names to jaraco.stream.egg-info/top_level.txt reading manifest file 'jaraco.stream.egg-info/SOURCES.txt' writing manifest file 'jaraco.stream.egg-info/SOURCES.txt' copying jaraco/stream/somefile.json.gz -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_7/lib/jaraco/stream warning: build_py: byte-compiling is disabled, skipping. * python3_8: running distutils-r1_run_phase distutils-r1_python_compile python3.8 setup.py build -j 9 running build running build_py package init file 'jaraco/__init__.py' not found (or not a regular file) creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream copying jaraco/stream/__init__.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream copying jaraco/stream/gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream copying jaraco/stream/buffer.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream copying jaraco/stream/test_gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream running egg_info writing jaraco.stream.egg-info/PKG-INFO writing dependency_links to jaraco.stream.egg-info/dependency_links.txt writing requirements to jaraco.stream.egg-info/requires.txt writing top-level names to jaraco.stream.egg-info/top_level.txt reading manifest file 'jaraco.stream.egg-info/SOURCES.txt' writing manifest file 'jaraco.stream.egg-info/SOURCES.txt' copying jaraco/stream/somefile.json.gz -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_8/lib/jaraco/stream warning: build_py: byte-compiling is disabled, skipping. * python3_9: running distutils-r1_run_phase distutils-r1_python_compile python3.9 setup.py build -j 9 running build running build_py package init file 'jaraco/__init__.py' not found (or not a regular file) creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco creating /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream copying jaraco/stream/__init__.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream copying jaraco/stream/gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream copying jaraco/stream/buffer.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream copying jaraco/stream/test_gzip.py -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream running egg_info writing jaraco.stream.egg-info/PKG-INFO writing dependency_links to jaraco.stream.egg-info/dependency_links.txt writing requirements to jaraco.stream.egg-info/requires.txt writing top-level names to jaraco.stream.egg-info/top_level.txt reading manifest file 'jaraco.stream.egg-info/SOURCES.txt' writing manifest file 'jaraco.stream.egg-info/SOURCES.txt' copying jaraco/stream/somefile.json.gz -> /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2-python3_9/lib/jaraco/stream warning: build_py: byte-compiling is disabled, skipping. * Using python3.9 in global scope * python3_9: running distutils-r1_run_phase python_compile_all >>> Source compiled. >>> Test phase: dev-python/jaraco-stream-3.0.2 * python3_7: running distutils-r1_run_phase python_test python3.7 -m pytest -vv -ra -l ============================= test session starts ============================== platform linux -- Python 3.7.10, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3.7 cachedir: .pytest_cache rootdir: /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2, configfile: pytest.ini plugins: timeout-1.4.2 collecting ... collected 5 items jaraco/stream/buffer.py::stream.buffer.DecodingLineBuffer PASSED [ 20%] jaraco/stream/buffer.py::stream.buffer.LenientDecodingLineBuffer PASSED [ 40%] jaraco/stream/buffer.py::stream.buffer.LineBuffer PASSED [ 60%] jaraco/stream/test_gzip.py::test_lines_from_stream ERROR [ 80%] jaraco/stream/test_gzip.py::test_lines_completes ERROR [100%] ==================================== ERRORS ==================================== ___________________ ERROR at setup of test_lines_from_stream ___________________ self = http_class = req = , http_conn_args = {} host = 'localhost:8080' h = def do_open(self, http_class, req, **http_conn_args): """Return an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. """ host = req.host if not host: raise URLError('no host given') # will parse host:port h = http_class(host, timeout=req.timeout, **http_conn_args) h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update({k: v for k, v in req.headers.items() if k not in headers}) # TODO(jhylton): Should this be redesigned to handle # persistent connections? # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = {name.title(): val for name, val in headers.items()} if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: try: h.request(req.get_method(), req.selector, req.data, headers, > encode_chunked=req.has_header('Transfer-encoding')) h = headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} host = 'localhost:8080' http_class = http_conn_args = {} req = self = /usr/lib/python3.7/urllib/request.py:1350: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , method = 'GET' url = '/', body = None headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} def request(self, method, url, body=None, headers={}, *, encode_chunked=False): """Send a complete request to the server.""" > self._send_request(method, url, body, headers, encode_chunked) body = None encode_chunked = False headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} method = 'GET' self = url = '/' /usr/lib/python3.7/http/client.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , method = 'GET' url = '/', body = None headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} encode_chunked = False def _send_request(self, method, url, body, headers, encode_chunked): # Honor explicitly requested Host: and Accept-Encoding: headers. header_names = frozenset(k.lower() for k in headers) skips = {} if 'host' in header_names: skips['skip_host'] = 1 if 'accept-encoding' in header_names: skips['skip_accept_encoding'] = 1 self.putrequest(method, url, **skips) # chunked encoding will happen if HTTP/1.1 is used and either # the caller passes encode_chunked=True or the following # conditions hold: # 1. content-length has not been explicitly set # 2. the body is a file or iterable, but not a str or bytes-like # 3. Transfer-Encoding has NOT been explicitly set by the caller if 'content-length' not in header_names: # only chunk body if not explicitly set for backwards # compatibility, assuming the client code is already handling the # chunking if 'transfer-encoding' not in header_names: # if content-length cannot be automatically determined, fall # back to chunked encoding encode_chunked = False content_length = self._get_content_length(body, method) if content_length is None: if body is not None: if self.debuglevel > 0: print('Unable to determine size of %r' % body) encode_chunked = True self.putheader('Transfer-Encoding', 'chunked') else: self.putheader('Content-Length', str(content_length)) else: encode_chunked = False for hdr, value in headers.items(): self.putheader(hdr, value) if isinstance(body, str): # RFC 2616 Section 3.7.1 says that text default has a # default charset of iso-8859-1. body = _encode(body, 'body') > self.endheaders(body, encode_chunked=encode_chunked) body = None content_length = None encode_chunked = False hdr = 'Connection' header_names = frozenset({'host', 'connection', 'user-agent'}) headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} method = 'GET' self = skips = {'skip_host': 1} url = '/' value = 'close' /usr/lib/python3.7/http/client.py:1323: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message_body = None def endheaders(self, message_body=None, *, encode_chunked=False): """Indicate that the last header line has been sent to the server. This method sends the request to the server. The optional message_body argument can be used to pass a message body associated with the request. """ if self.__state == _CS_REQ_STARTED: self.__state = _CS_REQ_SENT else: raise CannotSendHeader() > self._send_output(message_body, encode_chunked=encode_chunked) encode_chunked = False message_body = None self = /usr/lib/python3.7/http/client.py:1272: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message_body = None, encode_chunked = False def _send_output(self, message_body=None, encode_chunked=False): """Send the currently buffered request and clear the buffer. Appends an extra \\r\\n to the buffer. A message_body may be specified, to be appended to the request. """ self._buffer.extend((b"", b"")) msg = b"\r\n".join(self._buffer) del self._buffer[:] > self.send(msg) encode_chunked = False message_body = None msg = (b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUse' b'r-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n') self = /usr/lib/python3.7/http/client.py:1032: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUser-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n' def send(self, data): """Send `data' to the server. ``data`` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object. """ if self.sock is None: if self.auto_open: > self.connect() data = (b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUse' b'r-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n') self = /usr/lib/python3.7/http/client.py:972: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def connect(self): """Connect to the host and port specified in __init__.""" self.sock = self._create_connection( > (self.host,self.port), self.timeout, self.source_address) self = /usr/lib/python3.7/http/client.py:944: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('localhost', 8080), timeout = source_address = None def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ host, port = address err = None for res in getaddrinfo(host, port, 0, SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket(af, socktype, proto) if timeout is not _GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) sock.connect(sa) # Break explicitly a reference cycle err = None return sock except error as _: err = _ if sock is not None: sock.close() if err is not None: try: > raise err address = ('localhost', 8080) af = canonname = '' err = None host = 'localhost' port = 8080 proto = 6 res = (, , 6, '', ('::1', 8080, 0, 0)) sa = ('::1', 8080, 0, 0) sock = socktype = source_address = None timeout = /usr/lib/python3.7/socket.py:728: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('localhost', 8080), timeout = source_address = None def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ host, port = address err = None for res in getaddrinfo(host, port, 0, SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket(af, socktype, proto) if timeout is not _GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused address = ('localhost', 8080) af = canonname = '' err = None host = 'localhost' port = 8080 proto = 6 res = (, , 6, '', ('::1', 8080, 0, 0)) sa = ('::1', 8080, 0, 0) sock = socktype = source_address = None timeout = /usr/lib/python3.7/socket.py:716: ConnectionRefusedError During handling of the above exception, another exception occurred: gzip_server = 'http://localhost:8080/' @pytest.fixture def gzip_stream(gzip_server): > return urllib.request.urlopen(gzip_server) gzip_server = 'http://localhost:8080/' jaraco/stream/test_gzip.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.7/urllib/request.py:222: in urlopen return opener.open(url, data, timeout) cadefault = False cafile = None capath = None context = None data = None opener = timeout = url = 'http://localhost:8080/' /usr/lib/python3.7/urllib/request.py:525: in open response = self._open(req, data) data = None fullurl = 'http://localhost:8080/' meth = > meth_name = 'http_request' processor = protocol = 'http' req = self = timeout = /usr/lib/python3.7/urllib/request.py:543: in _open '_open', req) data = None protocol = 'http' req = result = None self = /usr/lib/python3.7/urllib/request.py:503: in _call_chain result = func(*args) args = (,) chain = {'data': [], 'file': [], 'ftp': [], 'http': [], 'https': [], 'unknown': []} func = > handler = handlers = [] kind = 'http' meth_name = 'http_open' self = /usr/lib/python3.7/urllib/request.py:1378: in http_open return self.do_open(http.client.HTTPConnection, req) req = self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = http_class = req = , http_conn_args = {} host = 'localhost:8080' h = def do_open(self, http_class, req, **http_conn_args): """Return an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. """ host = req.host if not host: raise URLError('no host given') # will parse host:port h = http_class(host, timeout=req.timeout, **http_conn_args) h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update({k: v for k, v in req.headers.items() if k not in headers}) # TODO(jhylton): Should this be redesigned to handle # persistent connections? # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = {name.title(): val for name, val in headers.items()} if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: try: h.request(req.get_method(), req.selector, req.data, headers, encode_chunked=req.has_header('Transfer-encoding')) except OSError as err: # timeout error > raise URLError(err) E urllib.error.URLError: h = headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} host = 'localhost:8080' http_class = http_conn_args = {} req = self = /usr/lib/python3.7/urllib/request.py:1352: URLError ____________________ ERROR at setup of test_lines_completes ____________________ self = http_class = req = , http_conn_args = {} host = 'localhost:8080' h = def do_open(self, http_class, req, **http_conn_args): """Return an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. """ host = req.host if not host: raise URLError('no host given') # will parse host:port h = http_class(host, timeout=req.timeout, **http_conn_args) h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update({k: v for k, v in req.headers.items() if k not in headers}) # TODO(jhylton): Should this be redesigned to handle # persistent connections? # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = {name.title(): val for name, val in headers.items()} if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: try: h.request(req.get_method(), req.selector, req.data, headers, > encode_chunked=req.has_header('Transfer-encoding')) h = headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} host = 'localhost:8080' http_class = http_conn_args = {} req = self = /usr/lib/python3.7/urllib/request.py:1350: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , method = 'GET' url = '/', body = None headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} def request(self, method, url, body=None, headers={}, *, encode_chunked=False): """Send a complete request to the server.""" > self._send_request(method, url, body, headers, encode_chunked) body = None encode_chunked = False headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} method = 'GET' self = url = '/' /usr/lib/python3.7/http/client.py:1277: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , method = 'GET' url = '/', body = None headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} encode_chunked = False def _send_request(self, method, url, body, headers, encode_chunked): # Honor explicitly requested Host: and Accept-Encoding: headers. header_names = frozenset(k.lower() for k in headers) skips = {} if 'host' in header_names: skips['skip_host'] = 1 if 'accept-encoding' in header_names: skips['skip_accept_encoding'] = 1 self.putrequest(method, url, **skips) # chunked encoding will happen if HTTP/1.1 is used and either # the caller passes encode_chunked=True or the following # conditions hold: # 1. content-length has not been explicitly set # 2. the body is a file or iterable, but not a str or bytes-like # 3. Transfer-Encoding has NOT been explicitly set by the caller if 'content-length' not in header_names: # only chunk body if not explicitly set for backwards # compatibility, assuming the client code is already handling the # chunking if 'transfer-encoding' not in header_names: # if content-length cannot be automatically determined, fall # back to chunked encoding encode_chunked = False content_length = self._get_content_length(body, method) if content_length is None: if body is not None: if self.debuglevel > 0: print('Unable to determine size of %r' % body) encode_chunked = True self.putheader('Transfer-Encoding', 'chunked') else: self.putheader('Content-Length', str(content_length)) else: encode_chunked = False for hdr, value in headers.items(): self.putheader(hdr, value) if isinstance(body, str): # RFC 2616 Section 3.7.1 says that text default has a # default charset of iso-8859-1. body = _encode(body, 'body') > self.endheaders(body, encode_chunked=encode_chunked) body = None content_length = None encode_chunked = False hdr = 'Connection' header_names = frozenset({'host', 'connection', 'user-agent'}) headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} method = 'GET' self = skips = {'skip_host': 1} url = '/' value = 'close' /usr/lib/python3.7/http/client.py:1323: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message_body = None def endheaders(self, message_body=None, *, encode_chunked=False): """Indicate that the last header line has been sent to the server. This method sends the request to the server. The optional message_body argument can be used to pass a message body associated with the request. """ if self.__state == _CS_REQ_STARTED: self.__state = _CS_REQ_SENT else: raise CannotSendHeader() > self._send_output(message_body, encode_chunked=encode_chunked) encode_chunked = False message_body = None self = /usr/lib/python3.7/http/client.py:1272: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message_body = None, encode_chunked = False def _send_output(self, message_body=None, encode_chunked=False): """Send the currently buffered request and clear the buffer. Appends an extra \\r\\n to the buffer. A message_body may be specified, to be appended to the request. """ self._buffer.extend((b"", b"")) msg = b"\r\n".join(self._buffer) del self._buffer[:] > self.send(msg) encode_chunked = False message_body = None msg = (b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUse' b'r-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n') self = /usr/lib/python3.7/http/client.py:1032: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUser-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n' def send(self, data): """Send `data' to the server. ``data`` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object. """ if self.sock is None: if self.auto_open: > self.connect() data = (b'GET / HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: localhost:8080\r\nUse' b'r-Agent: Python-urllib/3.7\r\nConnection: close\r\n\r\n') self = /usr/lib/python3.7/http/client.py:972: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def connect(self): """Connect to the host and port specified in __init__.""" self.sock = self._create_connection( > (self.host,self.port), self.timeout, self.source_address) self = /usr/lib/python3.7/http/client.py:944: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('localhost', 8080), timeout = source_address = None def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ host, port = address err = None for res in getaddrinfo(host, port, 0, SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket(af, socktype, proto) if timeout is not _GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) sock.connect(sa) # Break explicitly a reference cycle err = None return sock except error as _: err = _ if sock is not None: sock.close() if err is not None: try: > raise err address = ('localhost', 8080) af = canonname = '' err = None host = 'localhost' port = 8080 proto = 6 res = (, , 6, '', ('::1', 8080, 0, 0)) sa = ('::1', 8080, 0, 0) sock = socktype = source_address = None timeout = /usr/lib/python3.7/socket.py:728: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('localhost', 8080), timeout = source_address = None def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ host, port = address err = None for res in getaddrinfo(host, port, 0, SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket(af, socktype, proto) if timeout is not _GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) > sock.connect(sa) E ConnectionRefusedError: [Errno 111] Connection refused address = ('localhost', 8080) af = canonname = '' err = None host = 'localhost' port = 8080 proto = 6 res = (, , 6, '', ('::1', 8080, 0, 0)) sa = ('::1', 8080, 0, 0) sock = socktype = source_address = None timeout = /usr/lib/python3.7/socket.py:716: ConnectionRefusedError During handling of the above exception, another exception occurred: gzip_server = 'http://localhost:8080/' @pytest.fixture def gzip_stream(gzip_server): > return urllib.request.urlopen(gzip_server) gzip_server = 'http://localhost:8080/' jaraco/stream/test_gzip.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.7/urllib/request.py:222: in urlopen return opener.open(url, data, timeout) cadefault = False cafile = None capath = None context = None data = None opener = timeout = url = 'http://localhost:8080/' /usr/lib/python3.7/urllib/request.py:525: in open response = self._open(req, data) data = None fullurl = 'http://localhost:8080/' meth = > meth_name = 'http_request' processor = protocol = 'http' req = self = timeout = /usr/lib/python3.7/urllib/request.py:543: in _open '_open', req) data = None protocol = 'http' req = result = None self = /usr/lib/python3.7/urllib/request.py:503: in _call_chain result = func(*args) args = (,) chain = {'data': [], 'file': [], 'ftp': [], 'http': [], 'https': [], 'unknown': []} func = > handler = handlers = [] kind = 'http' meth_name = 'http_open' self = /usr/lib/python3.7/urllib/request.py:1378: in http_open return self.do_open(http.client.HTTPConnection, req) req = self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = http_class = req = , http_conn_args = {} host = 'localhost:8080' h = def do_open(self, http_class, req, **http_conn_args): """Return an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. """ host = req.host if not host: raise URLError('no host given') # will parse host:port h = http_class(host, timeout=req.timeout, **http_conn_args) h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update({k: v for k, v in req.headers.items() if k not in headers}) # TODO(jhylton): Should this be redesigned to handle # persistent connections? # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = {name.title(): val for name, val in headers.items()} if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: try: h.request(req.get_method(), req.selector, req.data, headers, encode_chunked=req.has_header('Transfer-encoding')) except OSError as err: # timeout error > raise URLError(err) E urllib.error.URLError: h = headers = {'Connection': 'close', 'Host': 'localhost:8080', 'User-Agent': 'Python-urllib/3.7'} host = 'localhost:8080' http_class = http_conn_args = {} req = self = /usr/lib/python3.7/urllib/request.py:1352: URLError =============================== warnings summary =============================== jaraco/stream/test_gzip.py:26 /var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2/jaraco/stream/test_gzip.py:26: PytestDeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. @pytest.yield_fixture -- Docs: https://docs.pytest.org/en/stable/warnings.html =========================== short test summary info ============================ ERROR jaraco/stream/test_gzip.py::test_lines_from_stream - urllib.error.URLEr... ERROR jaraco/stream/test_gzip.py::test_lines_completes - urllib.error.URLErro... ==================== 3 passed, 1 warning, 2 errors in 1.37s ==================== * ERROR: dev-python/jaraco-stream-3.0.2::gentoo failed (test phase): * pytest failed with python3.7 * * Call stack: * ebuild.sh, line 125: Called src_test * environment, line 2809: Called distutils-r1_src_test * environment, line 1194: Called _distutils-r1_run_foreach_impl 'python_test' * environment, line 449: Called python_foreach_impl 'distutils-r1_run_phase' 'python_test' * environment, line 2467: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' * environment, line 1986: Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' * environment, line 1984: Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test' * environment, line 751: Called distutils-r1_run_phase 'python_test' * environment, line 1133: Called python_test * environment, line 2751: Called distutils-r1_python_test * environment, line 1090: Called epytest * environment, line 1507: Called die * The specific snippet of code: * "${@}" || die -n "pytest failed with ${EPYTHON}"; * * If you need support, post the output of `emerge --info '=dev-python/jaraco-stream-3.0.2::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/jaraco-stream-3.0.2::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-python/jaraco-stream-3.0.2/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-python/jaraco-stream-3.0.2/temp/environment'. * Working directory: '/var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2' * S: '/var/tmp/portage/dev-python/jaraco-stream-3.0.2/work/jaraco.stream-3.0.2'