jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Site tests: Only test deleted revs if there are any ......................................................................
[FIX] Site tests: Only test deleted revs if there are any
Change-Id: I337fa2fce7a3cbfc3aa2d0fa5b87c3010a8d51c7 --- M tests/site_tests.py 1 file changed, 6 insertions(+), 1 deletion(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py index 4bfd22e..d3d7b84 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -947,7 +947,12 @@ pywikibot.warning( "Cannot test Site.deleted_revs; no sysop account configured.") return - dr = list(mysite.deletedrevs(total=10, page=mainpage))[0] + gen = mysite.deletedrevs(total=10, page=mainpage) + for dr in gen: + break + else: + raise unittest.SkipTest( + '{0} contains no deleted revisions.'.format(mainpage)) self.assertLessEqual(len(dr['revisions']), 10) self.assertTrue(all(isinstance(rev, dict) for rev in dr['revisions']))
pywikibot-commits@lists.wikimedia.org