jenkins-bot has submitted this change and it was merged.
Change subject: Test harness for scripts should login first
......................................................................
Test harness for scripts should login first
If the login does not happen first, the first script that attempts
to login will unexpectedly emit
Logging in to <site> as <user>
Change-Id: I41111456149aab7da02613e581e692d4e1058b31
---
M tests/script_tests.py
1 file changed, 13 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/script_tests.py b/tests/script_tests.py
index b371904..ef151ed 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -53,12 +53,13 @@
if name.endswith('.py')
and not name.startswith('_') # skip __init__.py and _*
and check_script_deps(name)
+ and name != 'login.py' # this is moved to be first
and name != 'imageuncat.py' # this halts indefinitely
and name != 'watchlist.py' # result depends on speed
and name != 'welcome.py' # result depends on speed
and name != 'script_wui.py' # depends on lua compiling
]
- return script_list
+ return ['login'] + script_list
script_input = {
'catall': 'q\n', # q for quit
@@ -192,7 +193,13 @@
return testScript
for script_name in runnable_script_list(scripts_path):
- test_name = 'test_' + script_name + '_execution'
+ # force login to be the first, alphabetically, so the login
+ # message does not unexpectedly occur during execution of
+ # another script.
+ if script_name == 'login':
+ test_name = 'test__' + script_name + '_execution'
+ else:
+ test_name = 'test_' + script_name + '_execution'
dct[test_name] = test_execution(script_name, ['-help'])
if script_name in ['shell', 'version',
'checkimages', # bug 68613
@@ -204,7 +211,10 @@
dct[test_name] = unittest.expectedFailure(dct[test_name])
dct[test_name].__doc__ = 'Test running ' + script_name + '.'
- test_name = 'test_' + script_name + '_no_args'
+ if script_name == 'login':
+ test_name = 'test__' + script_name + '_no_args'
+ else:
+ test_name = 'test_' + script_name + '_no_args'
dct[test_name] = test_execution(script_name, ['-simulate'],
no_args_expected_results)
if script_name in ['add_text', # raises custom NoEnoughData
--
To view, visit
https://gerrit.wikimedia.org/r/151291
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I41111456149aab7da02613e581e692d4e1058b31
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>