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

Xqt created this task.May 14 2016, 9:14 AM
Restricted Application added subscribers: pywikibot-bugs-list, Zppix, Aklapper. · View Herald TranscriptMay 14 2016, 9:14 AM
Xqt triaged this task as High priority.May 14 2016, 9:14 AM
Xqt added subscribers: jayvdb, AbdealiJK.

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 ?

Xqt added a subscriber: valhallasw.May 14 2016, 9:36 AM

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.

I think this is roughly a duplicate of T89769: testQueryApiGetter timeout failure .

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

Xqt added a comment.May 14 2016, 11:41 AM

Might be this one is caused by the other.

Multichill closed this task as Declined.May 20 2017, 1:16 PM
Multichill added a subscriber: Multichill.

Functionality was removed in T162585 . Declining this one.