jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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):

To view, visit change 671593. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id8db7cfdcbf6d18b1f2a4bc8e0d06ce5f42584cf
Gerrit-Change-Number: 671593
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged