jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] replacebot_tests: Avoid logging in
......................................................................
[FIX] replacebot_tests: Avoid logging in
As the tests aren't actually writing anything so logging in isn't necessary.
Instead it's patching the APISite instance to avoid the login call.
Change-Id: I5ba7e73b1cc682949a874a51445eae8ce79e3709
---
M tests/replacebot_tests.py
1 file changed, 14 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py
index cd854c8..8898834 100644
--- a/tests/replacebot_tests.py
+++ b/tests/replacebot_tests.py
@@ -33,6 +33,7 @@
family = 'test'
code = 'test'
+ cached = False
def setUp(self):
"""Replace the original bot class with a fake one."""
@@ -54,18 +55,31 @@
"""Nothing to do here."""
pass
+ def patched_login(sysop=False):
+ """Do nothing."""
+ pass
+
+ def patched_site(*args, **kwargs):
+ """Patching a Site instance replacing it's login."""
+ site = self._original_site(*args, **kwargs)
+ site.login = patched_login
+ return site
+
super(TestReplacementsMain, self).setUp()
self._original_bot = replace.ReplaceRobot
self._original_input = replace.pywikibot.input
+ self._original_site = replace.pywikibot.Site
self.bots = []
self.inputs = []
replace.ReplaceRobot = FakeReplaceBot
replace.pywikibot.input = self._fake_input
+ replace.pywikibot.Site = patched_site
def tearDown(self):
"""Bring back the old bot class."""
replace.ReplaceRobot = self._original_bot
replace.pywikibot.input = self._original_input
+ replace.pywikibot.Site = self._original_site
super(TestReplacementsMain, self).tearDown()
def _fake_input(self, message):
--
To view, visit https://gerrit.wikimedia.org/r/231582
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5ba7e73b1cc682949a874a51445eae8ce79e3709
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits