jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567243 )
Change subject: [tests] Skip HiddenKeyErrors within.TestLogEvents.test_logevents ......................................................................
[tests] Skip HiddenKeyErrors within.TestLogEvents.test_logevents
- test all logtypes - use subTest for every log type - use while loop instead of for loop to retrieve every single entry inside a try/except statement - skip subTest on HiddenKeyError
Bug: T216876 Change-Id: I7ca3a9bd463cfd2c66ec888289ea32d4097a6412 --- M tests/site_tests.py 1 file changed, 13 insertions(+), 4 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py index de2b044..e0af211 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1323,10 +1323,19 @@ self.assertLessEqual(len(le), 10) self.assertTrue(all(isinstance(entry, pywikibot.logentries.LogEntry) for entry in le)) - for typ in ('block', 'protect', 'rights', 'delete', 'upload', - 'move', 'import', 'patrol', 'merge'): - for entry in mysite.logevents(logtype=typ, total=3): - self.assertEqual(entry.type(), typ) + + for logtype in mysite.logtypes: + with self.subTest(logtype=logtype): + gen = iter(mysite.logevents(logtype=logtype, total=3)) + while True: + try: + entry = next(gen) + except StopIteration: + break + except HiddenKeyError as e: # T216876 + self.skipTest(e) + else: + self.assertEqual(entry.type(), logtype)
def test_logevents_mainpage(self): """Test logevents method on the main page."""
pywikibot-commits@lists.wikimedia.org