Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697732
)
Change subject: [tests] Fix deleting page._bot_may_edit cache
......................................................................
[tests] Fix deleting page._bot_may_edit cache
Change-Id: I9e223e35f72a044b99eaafc6a8deb5441cf057d7
---
M tests/page_tests.py
1 file changed, 6 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/page_tests.py b/tests/page_tests.py
index ffd1b98..2bf2674 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -760,7 +760,8 @@
def tearDown(self):
"""Cleanup cache."""
- del self.page._bot_may_edit
+ if hasattr(self.page, '_bot_may_edit'):
+ del self.page._bot_may_edit
super().tearDown()
def _run_test(self, template, user, expected_result):
@@ -769,7 +770,8 @@
self.page._text = template % {'user': user}
with self.subTest(template=template, user=user):
self.assertEqual(self.page.botMayEdit(), expected_result)
- del self.page._bot_may_edit
+ if hasattr(self.page, '_bot_may_edit'):
+ del self.page._bot_may_edit
@mock.patch.object(config, 'ignore_bot_templates', False)
def test_bot_may_edit_nobots_ok(self):
@@ -842,7 +844,8 @@
self.page._text = '{{bots|%s=}}' % param
with self.subTest(template=self.page.text, user=user, param=param):
self.assertTrue(self.page.botMayEdit())
- del self.page._bot_may_edit
+ if hasattr(self.page, '_bot_may_edit'):
+ del self.page._bot_may_edit
@mock.patch.object(config, 'ignore_bot_templates', False)
def test_bot_may_edit_bots_nok(self):
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697732
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: I9e223e35f72a044b99eaafc6a8deb5441cf057d7
Gerrit-Change-Number: 697732
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged