jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/742216 )
Change subject: [tests] Test whether pywikibot.argvu is not contaminated by global args ......................................................................
[tests] Test whether pywikibot.argvu is not contaminated by global args
running pwb -global_arg script -script_arg should be give the same argvu vector like running pwb -global_arg script -script_arg. Currently it fails due to T254435.
Bug: T254435 Change-Id: I1e8f0001d62a00f718bfd4f6fe4f86c4387869e8 --- A tests/pwb/print_argv.py M tests/pwb_tests.py 2 files changed, 33 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/pwb/print_argv.py b/tests/pwb/print_argv.py new file mode 100644 index 0000000..76d1adb --- /dev/null +++ b/tests/pwb/print_argv.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +"""Script that forms part of pwb_tests. + +.. versionadded:: 7.0 +""" +# +# (C) Pywikibot team, 2021 +# +# Distributed under the terms of the MIT license. +# +import pywikibot + + +def main() -> None: + """Print pywikibot.argvu.""" + print(pywikibot.argvu) + + +if __name__ == '__main__': + main() diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py index e86be66..66d4298 100644 --- a/tests/pwb_tests.py +++ b/tests/pwb_tests.py @@ -75,6 +75,19 @@ self.assertEqual('Häuser', vpwb['stdout'].strip()) self.assertEqual('Häuser', vpwb['stderr'].strip())
+ @unittest.expectedFailure # T254435 + def test_argv(self): + """Test argv of pywikibot. + + Make sure that argv passed to the script is not contaminated by + global options given to pwb.py wrapper. + """ + script_path = join_pwb_tests_path('print_argv.py') + without_global_args = execute_pwb([script_path, '-help']) + with_no_global_args = execute_pwb(['-maxlag:5', script_path, '-help']) + self.assertEqual(without_global_args['stdout'], + with_no_global_args['stdout']) + def test_script_found(self): """Test pwb.py script call which is found.""" stdout = io.StringIO(execute_pwb(['pwb'])['stdout'])
pywikibot-commits@lists.wikimedia.org