jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/671575 )
Change subject: [tests] use subTest for TestArchiveBot ......................................................................
[tests] use subTest for TestArchiveBot
Use subTest to show the content instead of catching the AssertionError
Change-Id: I1fd854f6f3271a15c898d627034be55aa53b8944 --- M tests/archivebot_tests.py 1 file changed, 9 insertions(+), 13 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py index 15b876c..da195bc 100644 --- a/tests/archivebot_tests.py +++ b/tests/archivebot_tests.py @@ -159,20 +159,16 @@ .format(len(talk.threads), talk, THREADS[code]))
for thread in talk.threads: - self.assertIsInstance(thread, archivebot.DiscussionThread) - self.assertIsInstance(thread.title, str) - self.assertIsInstance(thread.ts, TimeStripper) - self.assertEqual(thread.ts, talk.timestripper) - self.assertIsInstance(thread.code, str) - self.assertEqual(thread.code, talk.timestripper.site.code) - self.assertIsInstance(thread.content, str) - try: + with self.subTest(thread=thread.title, + content=thread.content[-72:]): + self.assertIsInstance(thread, archivebot.DiscussionThread) + self.assertIsInstance(thread.title, str) + self.assertIsInstance(thread.ts, TimeStripper) + self.assertEqual(thread.ts, talk.timestripper) + self.assertIsInstance(thread.code, str) + self.assertEqual(thread.code, talk.timestripper.site.code) + self.assertIsInstance(thread.content, str) self.assertIsInstance(thread.timestamp, datetime) - except AssertionError: - if thread.code not in self.expected_failures: - pywikibot.output('code {}: {}' - .format(thread.code, thread.content)) - raise
expected_failures = ['ar', 'eo', 'pdc', 'th'] # FIXME: see TestArchiveBotAfterDateUpdate()
pywikibot-commits@lists.wikimedia.org