Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 550710 - dev-python/wsgiintercept tests fail without network connection
Summary: dev-python/wsgiintercept tests fail without network connection
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-29 03:41 UTC by Patrick Lauer
Modified: 2015-06-02 16:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Lauer gentoo-dev 2015-05-29 03:41:33 UTC
>                   data = self._sock.recv(self._rbufsize)
E                   error: [Errno 104] Connection reset by peer

/usr/lib64/pypy/lib-python/2.7/socket.py:534: error
_________________________________________________________________________________________ test_https_not_intercepted __________________________________________________________________________________________

    def test_https_not_intercepted():
        with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:
>           response = url_lib.urlopen('https://google.com/')

test/test_urllib.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/pypy/lib-python/2.7/urllib2.py:154: in urlopen
    return opener.open(url, data, timeout)
/usr/lib64/pypy/lib-python/2.7/urllib2.py:431: in open
    response = self._open(req, data)
/usr/lib64/pypy/lib-python/2.7/urllib2.py:449: in _open
    '_open', req)
/usr/lib64/pypy/lib-python/2.7/urllib2.py:409: in _call_chain
    result = func(*args)
wsgi_intercept/urllib_intercept.py:26: in https_open
    return self.do_open(WSGI_HTTPSConnection, req)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <wsgi_intercept.urllib_intercept.WSGI_HTTPSHandler instance at 0x0000000002386540>, http_class = <class wsgi_intercept.WSGI_HTTPSConnection at 0x000000000119e250>
req = <urllib2.Request instance at 0x00000000023865e0>, http_conn_args = {}, host = 'google.com', h = <wsgi_intercept.WSGI_HTTPSConnection instance at 0x0000000002386620>
err = error(101, 'Network is unreachable')

    def do_open(self, http_class, req, **http_conn_args):
        """Return an addinfourl object for the request, using http_class.
    
            http_class must implement the HTTPConnection API from httplib.
            The addinfourl return value is a file-like object.  It also
            has methods and attributes including:
                - info(): return a mimetools.Message object for the headers
                - geturl(): return the original request URL
                - code: HTTP status code
            """
        host = req.get_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(dict((k, v) for k, v in req.headers.items()
                            if k not in headers))
    
        # 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 = dict(
            (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:
            h.request(req.get_method(), req.get_selector(), req.data, headers)
        except socket.error, err: # XXX what error?
            h.close()
>           raise URLError(err)
E           URLError: <urlopen error [Errno 101] Network is unreachable>

/usr/lib64/pypy/lib-python/2.7/urllib2.py:1197: URLError
==================================================================================== 6 failed, 30 passed in 514.14 seconds ====================================================================================
 * ERROR: dev-python/wsgiintercept-0.10.0::gentoo failed (test phase):
 *   Tests failed under pypy
Comment 1 Ian Delaney (RETIRED) gentoo-dev 2015-06-02 16:03:02 UTC
  02 Jun 2015; Ian Delaney <idella4@gentoo.org> wsgiintercept-0.10.0.ebuild:
  Disable tests connecting to the network, fixes Bug #550710