From 472a946789974837ece43b0aea88c72a0d875dd8 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Fri, 8 Nov 2019 17:24:25 +0100 Subject: [PATCH] Improve feedback from AssertionError --- kalite/testing/mixins/browser_mixins.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kalite/testing/mixins/browser_mixins.py b/kalite/testing/mixins/browser_mixins.py index 9a2a3ac0d4..df9a78b5c1 100644 --- a/kalite/testing/mixins/browser_mixins.py +++ b/kalite/testing/mixins/browser_mixins.py @@ -127,7 +127,11 @@ def browser_check_django_message(self, message_type=None, contains=None, exact=N if num_messages is not None: msg = "Make sure there are %d message(s), type='%s'." % \ (num_messages, message_type if message_type else "(any)") - self.assertEqual(num_messages, len(messages), msg) + try: + self.assertEqual(num_messages, len(messages), msg) + except AssertionError: + print("Wrong number of matching messages found in:\n{}".format("\n".join(messages))) + raise for i, message in enumerate(messages): if type(contains) == list: