Page MenuHomePhabricator

wikidataquery_tests.TestApiSlowFunctions.testQueryApiGetter fails for python 3.4
Closed, DeclinedPublic

Description

With python 3.4 wikidataquery_tests.TestApiSlowFunctions.testQueryApiGetter fails for an unexpected keyword argument 'buffering':

4011======================================================================
4012ERROR: testQueryApiGetter (tests.wikidataquery_tests.TestApiSlowFunctions)
4013Test that we can actually retreive data and that caching works.
4014----------------------------------------------------------------------
4015Traceback (most recent call last):
4016  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 385, in _make_request
4017    httplib_response = conn.getresponse(buffering=True)
4018TypeError: getresponse() got an unexpected keyword argument 'buffering'

See https://travis-ci.org/wikimedia/pywikibot-core/jobs/129968372

Event Timeline

As mentioned in https://github.com/kennethreitz/requests/issues/2510 this is an error of a ReadTimeout rather than the TypeError.

Hence, this is probably non-deterministic because of a slow internet connection or a network timeout ?

The last exception of the exceptions tree is raise ReadTimeout(e, request=request) :

4071  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/comms/http.py", line 331, in _http_process
4072    verify=not ignore_validation)
4073  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/requests/sessions.py", line 475, in request
4074    resp = self.send(prep, **send_kwargs)
4075  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/requests/sessions.py", line 585, in send
4076    r = adapter.send(request, **kwargs)
4077  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/requests/adapters.py", line 479, in send
4078    raise ReadTimeout(e, request=request)
4079requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='wdq.wmflabs.org', port=443): Read timed out. (read timeout=30)

which should be handled by pywikibot.comms.http:

def _http_process(session, http_request):
...
        response = session.request(method, uri, data=body, headers=headers,
                                   auth=auth, timeout=timeout,
                                   verify=not ignore_validation)
    except Exception as e:
        http_request.data = e
    else:
        http_request.data = response

But it didn't?

This appears to be the problem raised as https://github.com/shazow/urllib3/issues/682

It looks like this has been solved Upstream in urllib3, at https://github.com/shazow/urllib3/pull/861

It could take a while for that bugfix in urllib3 to be vendored into a requests release.

@Xqt, _http_process did handle it. http_request.data = e was done, and that causes it to be re-raised later.

Might be this one is caused by the other.

Multichill subscribed.

Functionality was removed in T162585 . Declining this one.