jenkins-bot merged this change.
[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(-)
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."""
To view, visit change 567243. To unsubscribe, or for help writing mail filters, visit settings.