jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/671593 )
Change subject: [tests] use subTest for TestArchiveBotAfterDateUpdate ......................................................................
[tests] use subTest for TestArchiveBotAfterDateUpdate
- Use subTest to show the content instead of catching the AssertionError - Remove empty expected_failures list which is default already
Change-Id: Id8db7cfdcbf6d18b1f2a4bc8e0d06ce5f42584cf --- M tests/archivebot_tests.py 1 file changed, 9 insertions(+), 15 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py index da195bc..3314892 100644 --- a/tests/archivebot_tests.py +++ b/tests/archivebot_tests.py @@ -219,22 +219,16 @@ THREADS_WITH_UPDATED_FORMAT[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 = []
class TestDiscussionPageObject(TestCase):
pywikibot-commits@lists.wikimedia.org