jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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'])

To view, visit change 742216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1e8f0001d62a00f718bfd4f6fe4f86c4387869e8
Gerrit-Change-Number: 742216
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged