Page MenuHomePhabricator

script_tests fails for flickrripper.py
Closed, ResolvedPublic

Description

script_tests fails for flickrripper.py after this change: https://gerrit.wikimedia.org/r/#/c/pywikibot/core/+/463455/5/tests/script_tests.py

=================================== FAILURES ===================================
_____________________ TestScriptSimulate.test_flickrripper _____________________

self = <tests.script_tests.TestScriptSimulate testMethod=test_flickrripper>

    def testScript(self):
        global_args = 'Global arguments available for all'
    
        cmd = [script_name]
    
        if args:
            cmd += args
    
        data_in = script_input.get(script_name)
    
        timeout = 0
        if is_autorun:
            timeout = 5
    
        if self._results and script_name in self._results:
            error = self._results[script_name]
            if isinstance(error, StringTypes):
                stdout = None
            else:
                stdout, error = error
        else:
            stdout = None
            error = None
    
        test_overrides = {}
        if not hasattr(self, 'net') or not self.net:
            test_overrides['pywikibot.Site'] = 'None'
    
        result = execute_pwb(cmd, data_in, timeout=timeout,
                             error=error, overrides=test_overrides)
    
        stderr = result['stderr'].splitlines()
        stderr_sleep = [l for l in stderr
                        if l.startswith('Sleeping for ')]
        stderr_other = [l for l in stderr
                        if not l.startswith('Sleeping for ')]
        if stderr_sleep:
            unittest_print('\n'.join(stderr_sleep))
    
        if result['exit_code'] == -9:
            unittest_print(' killed', end='  ')
    
        if error:
            self.assertIn(error, result['stderr'])
    
            exit_codes = [0, 1, 2, -9]
        elif not is_autorun:
            if stderr_other == []:
                stderr_other = None
            if stderr_other is not None:
                self.assertIn('Use -help for further information.',
>                             stderr_other)
E               AssertionError: u'Use -help for further information.' not found in [u'ERROR: This script requires the python flickrapi module. ', u'See: http://stuvel.eu/projects/flickrapi']

tests/script_tests.py:288: AssertionError

Event Timeline

Xqt triaged this task as High priority.Nov 17 2018, 12:05 PM

In PYSETUP_TEST_EXTRAS=1 environment I can see a different issue (https://travis-ci.org/wikimedia/pywikibot/jobs/456314236):

======================================================================
FAIL: test_flickrripper (tests.script_tests.TestScriptSimulate)
Test running flickrripper -simulate.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot/tests/script_tests.py", line 288, in testScript
    stderr_other)
AssertionError: u'Use -help for further information.' not found in [u'WARNING: Flickr api key not found! Get yourself an api key', u'Any flickr user can get a key at', u'https://www.flickr.com/services/api/keys/apply/']
----------------------------------------------------------------------

In PYSETUP_TEST_EXTRAS=0 environment it is easy issue: flickrapi is not installed.

I am wondering about this because 'flickrripper' should be part of the _expected_failures set inside TestScriptSimulate.

Change 474523 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Use a copy of failed_dep_script_set for _expected_failures

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

Change 474523 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Use a copy of failed_dep_script_set for _expected_failures

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