jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/742212 )
Change subject: [tests] use main() function with pwb print tests ......................................................................
[tests] use main() function with pwb print tests
Change-Id: Idbee53f648ecfd0104ead95987cd3e20e9650a42 --- M tests/pwb/print_env.py M tests/pwb/print_locals.py M tests/pwb/print_unicode.py 3 files changed, 16 insertions(+), 6 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/pwb/print_env.py b/tests/pwb/print_env.py index f8ea695..29e364c 100644 --- a/tests/pwb/print_env.py +++ b/tests/pwb/print_env.py @@ -1,7 +1,7 @@ #!/usr/bin/python """Script that forms part of pwb_tests.""" # -# (C) Pywikibot team, 2015-2020 +# (C) Pywikibot team, 2015-2021 # # Distributed under the terms of the MIT license. # @@ -11,7 +11,7 @@ from pywikibot.tools import first_upper
-def main(): +def main() -> None: """Print environment variables.""" _pwb_dir = os.path.abspath(os.path.join( os.path.split(__file__)[0], '..', '..')) diff --git a/tests/pwb/print_locals.py b/tests/pwb/print_locals.py index 4e2df8e..4560441 100644 --- a/tests/pwb/print_locals.py +++ b/tests/pwb/print_locals.py @@ -1,14 +1,15 @@ #!/usr/bin/python """Script that forms part of pwb_tests.""" # -# (C) Pywikibot team, 2013-2020 +# (C) Pywikibot team, 2013-2021 # # Distributed under the terms of the MIT license. # import os.path
-if __name__ == '__main__': +def main() -> None: + """Print locals().""" for k, v in sorted(locals().copy().items()): # Skip a few items that Python 3 adds and are not emulated in pwb. if k in ['__cached__', '__loader__', '__spec__', '__annotations__']: @@ -17,3 +18,7 @@ print('__file__: ' + os.path.join('.', os.path.relpath(__file__))) else: print('{}: {}'.format(k, v)) + + +if __name__ == '__main__': + main() diff --git a/tests/pwb/print_unicode.py b/tests/pwb/print_unicode.py index 220c8a3..3f93dc7 100644 --- a/tests/pwb/print_unicode.py +++ b/tests/pwb/print_unicode.py @@ -1,13 +1,18 @@ #!/usr/bin/python """Script that forms part of pwb_tests.""" # -# (C) Pywikibot team, 2020 +# (C) Pywikibot team, 2018-2021 # # Distributed under the terms of the MIT license. # import pywikibot
-if __name__ == '__main__': +def main() -> None: + """Print umlauts.""" pywikibot.output('Häuser') print('Häuser') + + +if __name__ == '__main__': + main()
pywikibot-commits@lists.wikimedia.org