Page MenuHomePhabricator

test_processSource_with_one_okay_picture_out_of_two hits live API
Closed, ResolvedPublic

Description

Trying to run the unit tests while being offline, I noticed that test_processSource_with_one_okay_picture_out_of_two in tests/test_populate_image_table.py needs connection, otherwise it hangs with:

py27 runtests: commands[0] | nosetests tests/test_populate_image_table.py
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
nose.plugins.cover: INFO: Coverage report will include only packages: ['erfgoedbot']
Trying to normalize the identifier of the first image throws a CannotNormalizeException, ... Processing country "aa"
For country "aa" I found 2 photos tagged with "{{Template_A}}" in [[Category:Tracker_category_A]]
Could not normalize monument identifier  00000044
EXAMPLE - 01.JPG (Example_-_01.jpg)
WARNING: labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/data/api.py:310: UserWarning: Unexpected overlap between action and query submodules: frozenset([u'globalpreferences', u'readinglists'])
ERROR: Traceback (most recent call last):
  File "labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/data/api.py", line 1954, in submit
    body=body, headers=headers)
  File "labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/tools/__init__.py", line 1448, in wrapper
    return obj(*__args, **__kw)
  File "labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/comms/http.py", line 328, in request
    r = fetch(baseuri, method, params, body, headers, **kwargs)
  File "labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/comms/http.py", line 515, in fetch
    error_handling_callback(request)
  File "labs-tools-heritage/.tox/py27/local/lib/python2.7/site-packages/pywikibot/comms/http.py", line 402, in error_handling_callback
    raise request.data
ConnectionError: HTTPSConnectionPool(host='commons.wikimedia.org', port=443): Max retries exceeded with url: /w/api.php (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff463a97d90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

WARNING: Waiting 5 seconds before retrying.

At first glance, this is because has_geolocation is not mocked. I seem to recall it was not needed but evidently it is :)

Event Timeline

Change 448008 had a related patch set uploaded (by Jean-Frédéric; owner: Jean-Frédéric):
[labs/tools/heritage@master] Mock has_geolocation in test_processSource_with_one_okay_picture_out_of_two

https://gerrit.wikimedia.org/r/448008

Change 448008 merged by jenkins-bot:
[labs/tools/heritage@master] Mock has_geolocation in test_processSource_with_one_okay_picture_out_of_two

https://gerrit.wikimedia.org/r/448008