jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Show help string if argument is -help or starts with -help:

- Show help string if argument is "-help" or starts with "-help:"
like "-help:global" even a required package is missing
- use -help option for script tests to detect scripts which are
member of auto_run_script_list; update test result accordingly

Bug: T264498
Change-Id: I8e8bab1f01a24306eedf810a586dac3817af1128
---
M pwb.py
M tests/script_tests.py
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pwb.py b/pwb.py
index 19162c7..497f72f 100755
--- a/pwb.py
+++ b/pwb.py
@@ -348,7 +348,9 @@
warn('Parent module %s not found: %s'
% (file_package, e), ImportWarning)

- if check_modules(filename) or '-help' in script_args:
+ help_option = any(arg.startswith('-help:') or arg == 'help'
+ for arg in script_args)
+ if check_modules(filename) or help_option:
run_python_file(filename,
[filename] + script_args,
[Path(filename).stem] + argvu[1:],
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 085a748..2802c12 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -214,7 +214,7 @@
.format(script_name))

def testScript(self):
- global_args = 'Global arguments available for all'
+ global_args = 'For global options use -help:global or run pwb'

cmd = [script_name] + args
data_in = script_input.get(script_name)
@@ -352,7 +352,7 @@
_expected_failures = {'version'}
_allowed_failures = []

- _arguments = '-help:global'
+ _arguments = '-help'
_results = None



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

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