jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/352172 )
Change subject: [pep8] Keep lines of script_tests.py beneath 80 chars ......................................................................
[pep8] Keep lines of script_tests.py beneath 80 chars
Change-Id: I34b5710d761dd75ef101c441845c7d0cd57dbe25 --- M tests/script_tests.py 1 file changed, 20 insertions(+), 11 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/tests/script_tests.py b/tests/script_tests.py index 6808946..3d78c82 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -17,7 +17,8 @@ )
from tests import join_root_path -from tests.aspects import unittest, DefaultSiteTestCase, MetaTestCaseClass, PwbTestCase +from tests.aspects import (unittest, DefaultSiteTestCase, MetaTestCaseClass, + PwbTestCase) from tests.utils import allowed_failure, execute_pwb, add_metaclass
scripts_path = join_root_path('scripts') @@ -101,7 +102,9 @@ 'catall': 'q\n', # q for quit 'editarticle': 'Test page\n', 'imageuncat': 'q\n', - 'imageharvest': 'https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg%5C...', + 'imageharvest': + 'https://upload.wikimedia.org/wikipedia/commons/' + '8/80/Wikipedia-logo-v2.svg\n\n', 'interwiki': 'Test page that should not exist\n', 'misspelling': 'q\n', 'pagefromfile': 'q\n', @@ -109,7 +112,9 @@ # Enter to begin, Enter for default summary. 'shell': '\n', # exits on end of stdin 'solve_disambiguation': 'Test page\nq\n', - 'upload': 'https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg%5C...', + 'upload': + 'https://upload.wikimedia.org/wikipedia/commons/' + '8/80/Wikipedia-logo-v2.svg\n\n\n', }
auto_run_script_list = [ @@ -149,7 +154,8 @@ 'featured': '0 pages written.', 'freebasemappingupload': 'Cannot find ', 'harvest_template': 'ERROR: Please specify', - 'imageuncat': 'WARNING: This script is primarily written for Wikimedia Commons', + 'imageuncat': + 'WARNING: This script is primarily written for Wikimedia Commons', # script_input['interwiki'] above lists a title that should not exist 'interwiki': 'does not exist. Skipping.', 'imageharvest': 'From what URL should I get the images', @@ -237,14 +243,18 @@ def __new__(cls, name, bases, dct): """Create the new class.""" def test_execution(script_name, args=[]): - is_autorun = '-help' not in args and script_name in auto_run_script_list + is_autorun = ('-help' not in args and + script_name in auto_run_script_list)
def test_skip_script(self): raise unittest.SkipTest( 'Skipping execution of auto-run scripts (set ' - 'PYWIKIBOT2_TEST_AUTORUN=1 to enable) "{0}"'.format(script_name)) + 'PYWIKIBOT2_TEST_AUTORUN=1 to enable) "{0}"' + .format(script_name))
def testScript(self): + GLOBAL_ARGS = 'Global arguments available for all' + cmd = [script_name]
if args: @@ -270,8 +280,8 @@ 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) + result = execute_pwb(cmd, data_in, timeout=timeout, + error=error, overrides=test_overrides)
stderr = result['stderr'].splitlines() stderr_sleep = [l for l in stderr @@ -296,8 +306,7 @@ stderr_other) self.assertNotIn('-help', args) else: - self.assertIn('Global arguments available for all', - result['stdout']) + self.assertIn(GLOBAL_ARGS, result['stdout'])
exit_codes = [0] else: @@ -319,7 +328,7 @@ self.assertNotIn('deprecated', result['stderr'].lower())
# If stdout doesnt include global help.. - if 'Global arguments available for all' not in result['stdout']: + if GLOBAL_ARGS not in result['stdout']: # Specifically look for deprecated self.assertNotIn('deprecated', result['stdout'].lower()) if result['stdout'] == '':
pywikibot-commits@lists.wikimedia.org