jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/615757 )
Change subject: [cleanup] rename ScenarioDefinedDefaultSiteTestCase to ScriptMainTestCase
......................................................................
[cleanup] rename ScenarioDefinedDefaultSiteTestCase to ScriptMainTestCase
ScriptMainTestCase is derived from ScenarioDefinedDefaultSiteTestCase
but is just an alias whereas ScenarioDefinedDefaultSiteTestCase is not
used elsewhere. Therefore rename ScenarioDefinedDefaultSiteTestCase to
ScriptMainTestCase.
Change-Id: I927000a2ade26f8cc0c88721ae0a8ba467a883bc
---
M tests/aspects.py
1 file changed, 2 insertions(+), 9 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 5c368a4..67e7eba 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1209,13 +1209,13 @@
super(AlteredDefaultSiteTestCase, self).tearDown()
-class ScenarioDefinedDefaultSiteTestCase(AlteredDefaultSiteTestCase):
+class ScriptMainTestCase(AlteredDefaultSiteTestCase):
"""Tests that depend on the default site being set to the test site."""
def setUp(self):
"""Prepare the environment for running main() in a script."""
- super(ScenarioDefinedDefaultSiteTestCase, self).setUp()
+ super().setUp()
site = self.get_site()
pywikibot.config.family = site.family
pywikibot.config.mylang = site.code
@@ -1369,13 +1369,6 @@
.format(cls.__name__, cls.get_site()))
-class ScriptMainTestCase(ScenarioDefinedDefaultSiteTestCase):
-
- """Test running a script main()."""
-
- pass
-
-
class PwbTestCase(TestCase):
"""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/615757
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I927000a2ade26f8cc0c88721ae0a8ba467a883bc
Gerrit-Change-Number: 615757
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/615567 )
Change subject: [IMPR] Simplify bot.handle_args() function
......................................................................
[IMPR] Simplify bot.handle_args() function
Change-Id: I5d80c2fa29cfa51752271d2ca68dc78f69400a3a
---
M pywikibot/bot.py
1 file changed, 6 insertions(+), 10 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 2c3e105..70b2b14 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -807,17 +807,16 @@
# it's the version in pywikibot.__init__ that is changed by scripts,
# not the one in pywikibot.bot.
args = pywikibot.argvu[1:]
+
# get the name of the module calling this function. This is
# required because the -help option loads the module's docstring and
# because the module name will be used for the filename of the log.
- module_name = calledModuleName()
- if not module_name:
- module_name = 'terminal-interface'
+ module_name = calledModuleName() or 'terminal-interface'
non_global_args = []
username = None
do_help = None if do_help else False
for arg in args:
- option, sep, value = arg.partition(':')
+ option, _, value = arg.partition(':')
if do_help is not False and option == '-help':
do_help = True
elif option == '-dir':
@@ -871,15 +870,12 @@
elif option == '-debug':
if module_name not in config.log:
config.log.append(module_name)
- if value:
- if value not in config.debug_log:
- config.debug_log.append(value)
- elif '' not in config.debug_log:
- config.debug_log.append('')
+ if value not in config.debug_log:
+ config.debug_log.append(value) # may be empty string
elif option in ('-verbose', '-v'):
config.verbose_output += 1
elif option == '-daemonize':
- redirect_std = value if value else None
+ redirect_std = value or None
daemonize.daemonize(redirect_std=redirect_std)
else:
# the argument depends on numerical config settings
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/615567
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5d80c2fa29cfa51752271d2ca68dc78f69400a3a
Gerrit-Change-Number: 615567
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged