Page MenuHomePhabricator

imagecopy_tests failing with IndexError
Closed, DeclinedPublic

Description

CommonsHelperMethodTest.test_pageTextPost ___________________

self = <tests.imagecopy_tests.CommonsHelperMethodTest testMethod=test_pageTextPost>

    def test_pageTextPost(self):
        """Test scripts.imagecopy.pageTextPost() method."""
        parameters_dict = {
            'language': b'id',
            'image': b'Ahmad Syaikhu Wakil Walikota Bekasi.jpg',
            'newname': b'Ahmad Syaikhu Wakil Walikota Bekasi.jpg',
            'project': b'wikipedia',
            'username': '',
            'commonsense': '1',
            'remove_categories': '1',
            'ignorewarnings': '1',
            'doit': 'Uitvoeren'}
    
        commons_helper = pageTextPost('', parameters_dict)
        # Extract the CommonsHelper description from the html
        commons_helper = (
            re.compile(
                "<textarea .+ name='wpUploadDescription'>(.+)</textarea>",
>               re.DOTALL | re.M).findall(commons_helper)[0])
E       IndexError: list index out of range

tests/imagecopy_tests.py:41: IndexError

Related Objects

Event Timeline

Xqt triaged this task as High priority.Oct 21 2018, 5:27 AM

While trying to track where the problem comes from, I don't think it's Pywikibot related though it happens within it. There seems to be an issue with the commonshelper tool, I tried making a request via web browser and I get this error;

Fatal error: Call to undefined function getSubResults() in /data/project/magnustools/public_html/php/wikiquery.php on line 98

So the tool needs attention.

@Xqt, as a confirmation, when I try to print out the value of commons_helper on L36, I get the same output as on my web browser;

<br />
<b>Fatal error</b>:  Call to undefined function getSubResults() in <b>/data/project/magnustools/public_html/php/wikiquery.php</b> on line <b>98</b><br />

Change 469049 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [test] Temporary accept imagecopy_tests.py failing

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

This should be fixed now in CommonsHelper.

Still failing, but hopefully only due to the cache.

Still failing, but hopefully only due to the cache.

No. I committed a new patch which also failed

This should be fixed now in CommonsHelper.

@Magnus I've tried some existing enwiki images, but each of them does not exist according to CommonsHelper.

-> Therefore it seems the tool is still broken. It makes the same response for Pywikibot and Pywikibot's example image (also claimed not to exist by CommonsHelper even if it exists actually)

Try it now please.

On my machine, sometimes I get a correct response from the tool and sometimes I get Fatal error: Class 'Template' not found in /data/project/commonshelper/public_html/index.php on line 317

On Travis machine the build is still failing too.

The test is looking for <textarea> in the returned value of pageTextPost which does not have it. I've created a paste of the actual retrieved data at P7716. This might be a UI change and in which case we might need to update some parts of the imagecopy.py accordingly.

The test is looking for <textarea> in the returned value of pageTextPost which does not have it. I've created a paste of the actual retrieved data at P7716. This might be a UI change and in which case we might need to update some parts of the imagecopy.py accordingly.

Sure, but first the tool should not give errors like Fatal error: Call to undefined function getSubResults() in /data/project/magnustools/public_html/php/wikiquery.php on line 98 and Fatal error: Class 'Template' not found in /data/project/commonshelper/public_html/index.php on line 317 because now the tool gives the error instead of textarea or whatever UI element it should be.

Also we will need to change the file in our tests, because the current file has been transferred to Commons lately.

@Magnus Is there any progress in fixing the tool?

@Dvorapa: why shouldn't we disable thoses tests temporarily with that patch committed in https://gerrit.wikimedia.org/r/469049? The problem is noted here and it seems not easy to solve. All further travis and appveyor tests are failing now and there is no focus to other tests when they are failing currently. And last but not least I planned to upload the next release to pypi the next days but I always wait for some successfull tests.

@Xqt I thought Magnus will be faster in fixing the tool (he was pretty fast for the first problem). The test disabling patch would be useless for one day. But now I think we can disable the tests until Magnus will have the time to fix the tool properly.

Change 469049 merged by jenkins-bot:
[pywikibot/core@master] [test] Temporary accept imagecopy_tests.py failing

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

Change 481275 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Fix Tkdialog

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

Dvorapa moved this task from Needs Review to Upstream issues on the Pywikibot board.
Dvorapa moved this task from Backlog to Upstream issues on the Pywikibot-tests board.

This script is no longer maintained. Please reopen if you are still using this script.

Change 481275 abandoned by Xqt:
[pywikibot/core@master] [bugfix] Fix Tkdialog

Reason:
no longer maintained

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