jenkins-bot has submitted this change and it was merged.
Change subject: Skip talk page tests if talk page doesnt exist
......................................................................
Skip talk page tests if talk page doesnt exist
Change-Id: I56531c8eb4cabee09a1b0d12ec4451e96fc37b42
---
M tests/page_tests.py
1 file changed, 17 insertions(+), 6 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 460f1e8..e462957 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -389,20 +389,15 @@
def testApiMethods(self):
"""Test various methods that rely on API."""
mainpage = self.get_mainpage()
- maintalk = mainpage.toggleTalkPage()
- badpage = self.get_missing_article()
# since there is no way to predict what data the wiki will return,
# we only check that the returned objects are of correct type.
- self.assertIsInstance(maintalk.get(), unicode)
- self.assertRaises(pywikibot.NoPage, badpage.get)
+ self.assertIsInstance(mainpage.get(), unicode)
self.assertIsInstance(mainpage.latestRevision(), int)
self.assertIsInstance(mainpage.userName(), unicode)
self.assertIsInstance(mainpage.isIpEdit(), bool)
self.assertIsInstance(mainpage.exists(), bool)
self.assertIsInstance(mainpage.isRedirectPage(), bool)
self.assertIsInstance(mainpage.isEmpty(), bool)
- self.assertEqual(mainpage.toggleTalkPage(), maintalk)
- self.assertEqual(maintalk.toggleTalkPage(), mainpage)
self.assertIsInstance(mainpage.isDisambig(), bool)
self.assertIsInstance(mainpage.canBeEdited(), bool)
self.assertIsInstance(mainpage.botMayEdit(), bool)
@@ -410,6 +405,22 @@
self.assertIsInstance(mainpage.previousRevision(), int)
self.assertIsInstance(mainpage.permalink(), basestring)
+ def test_talk_page(self):
+ """Test various methods that rely on API: talk
page."""
+ mainpage = self.get_mainpage()
+ maintalk = mainpage.toggleTalkPage()
+ if not maintalk.exists():
+ raise unittest.SkipTest("No talk page for %s's main page"
+ % self.get_site())
+ self.assertIsInstance(maintalk.get(), unicode)
+ self.assertEqual(mainpage.toggleTalkPage(), maintalk)
+ self.assertEqual(maintalk.toggleTalkPage(), mainpage)
+
+ def test_bad_page(self):
+ """Test various methods that rely on API: bad
page."""
+ badpage = self.get_missing_article()
+ self.assertRaises(pywikibot.NoPage, badpage.get)
+
def testIsDisambig(self):
"""Test the integration with
Extension:Disambiguator."""
site = self.get_site()
--
To view, visit
https://gerrit.wikimedia.org/r/170513
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I56531c8eb4cabee09a1b0d12ec4451e96fc37b42
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>