Page MenuHomePhabricator

test_imageharvest breaks tests
Closed, ResolvedPublic

Event Timeline

Xqt triaged this task as High priority.Jun 30 2017, 9:03 AM
Xqt lowered the priority of this task from High to Medium.Jul 5 2017, 11:55 AM
Xqt added a project: Pywikibot-tests.
Xqt subscribed.

tests are currently deactivated with https://gerrit.wikimedia.org/r/#/c/358434/

Dvorapa renamed this task from test_imageharness breaks tests to test_imageharvest breaks tests.May 15 2019, 12:53 AM
Dvorapa subscribed.

Change 588136 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] Revert "Disable imageharvest tests" and enable tests

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

This issue is solved already, probably with rPWBC3e0ada0f.

Change 588136 merged by jenkins-bot:
[pywikibot/core@master] Revert "Disable imageharvest tests" and enable tests

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

This issue is solved already, probably with rPWBC3e0ada0f.

No, on PY2 it was still failing after the patch you mention

(reverted, failed on PY2 the same way as in June 2019)

The new traceback is:

======================================================================
FAIL: test_imageharvest (tests.script_tests.TestScriptSimulate)
Test running imageharvest -simulate
----------------------------------------------------------------------
Traceback (most recent call last):

  File "C:\projects\pywikibot-g4xqx\tests\script_tests.py", line 289, in testScript
    err_result)
AssertionError: u'Traceback (most recent call last)' unexpectedly found in u'From what URL should I get the images? What text should be added at the end of the description of each image from this url? Traceback (most recent call last):
  File "C:\\projects\\pywikibot-g4xqx\\pwb.py", line 390, in <module>
    if not main():
  File "C:\\projects\\pywikibot-g4xqx\\pwb.py", line 385, in main
    file_package)
  File "C:\\projects\\pywikibot-g4xqx\\pwb.py", line 101, in run_python_file
    main_mod.__dict__)
  File ".\\scripts\\imageharvest.py", line 153, in <module>
    main()
  File ".\\scripts\\imageharvest.py", line 147, in main
    run_bot(url, image_url, desc)
  File ".\\scripts\\imageharvest.py", line 97, in run_bot
    ilinks = get_imagelinks(url)
  File ".\\scripts\\imageharvest.py", line 56, in get_imagelinks
    with urlopen(url) as f:
AttributeError: addinfourl instance has no attribute \'__exit__\'
CRITICAL: Exiting due to uncaught exception <type \'exceptions.AttributeError\'>
'

I guess imageharvest fails for Python anyway. A good reason to run tests ;-)

(reverted, failed on PY2 the same way as in June 2019)

No, with different traceback, see above.

This new bug is related to Python versions prior than 2.7.9, see the doc:
Changed in version 2.7.9: The context parameter was added. All the neccessary certificate and hostname checks are done by default.
In result, imageharvest cannot run with Python 2.7.4

Today it failed tests on Python 2.7.15 with the same traceback like year ago (see the duplicate task)

Change 588145 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Re-enable script test for imageharvest.py

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

Today it failed tests on Python 2.7.15 with the same traceback like year ago (see the duplicate task)

Cannot find the related traceback. But I am wondering about that missing context manager in Python 2.7.17
https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/builds/32122114/job/q26p8k50urv8f4ox?fullLog=true

There is another issue: urllib.basejoin() is used which is not implemented in Python 3 and not imported for Python 2

Today it failed tests on Python 2.7.15 with the same traceback like year ago (see the duplicate task)

Cannot find the related traceback. But I am wondering about that missing context manager in Python 2.7.17
https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/builds/32122114/job/q26p8k50urv8f4ox?fullLog=true

This is the traceback I am talking about (and the same as in 2019)

imageharvest seems quite broken at all then

imageharvest seems quite broken at all then

Yes.

Change 588145 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Re-enable script test for imageharvest.py

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

Xqt claimed this task.