From e44cff343f309d058e406c9a27c75767ccfd5213 Mon Sep 17 00:00:00 2001 From: heinzel Date: Tue, 13 Oct 2020 13:14:33 +0200 Subject: [PATCH 1/2] More Information on a failing test. dav_events.tests: sometimes an OneclickActionTest failes without providing enough information. --- dav_events/tests/test_oneclickactions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dav_events/tests/test_oneclickactions.py b/dav_events/tests/test_oneclickactions.py index c0b1da7..ee0f45e 100644 --- a/dav_events/tests/test_oneclickactions.py +++ b/dav_events/tests/test_oneclickactions.py @@ -121,7 +121,11 @@ class ActionTestCase(EmailTestMixin, RoleMixin, EventMixin, TestCase): 'user': user.get_full_name(), }) html = message.replace('\'', ''') - self.assertInHTML(html, content) + # Sometimes this test fail, and we cannot see the tested content, so we create our own Exception + try: + self.assertInHTML(html, content) + except AssertionError as e: + raise AssertionError('Not in HTML:\n{}\n-----\n{}\n'.format(html, content)) from e self.assertRegex(content, r'alert-success') def setUp(self): From 28a35d98d291b00f6f29a68b6c2275f3bcb1e4f9 Mon Sep 17 00:00:00 2001 From: heinzel Date: Tue, 13 Oct 2020 14:05:44 +0200 Subject: [PATCH 2/2] Fix the previous change --- dav_events/tests/test_oneclickactions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dav_events/tests/test_oneclickactions.py b/dav_events/tests/test_oneclickactions.py index ee0f45e..beee8c2 100644 --- a/dav_events/tests/test_oneclickactions.py +++ b/dav_events/tests/test_oneclickactions.py @@ -124,8 +124,8 @@ class ActionTestCase(EmailTestMixin, RoleMixin, EventMixin, TestCase): # Sometimes this test fail, and we cannot see the tested content, so we create our own Exception try: self.assertInHTML(html, content) - except AssertionError as e: - raise AssertionError('Not in HTML:\n{}\n-----\n{}\n'.format(html, content)) from e + except AssertionError: + raise AssertionError('Not in HTML:\n{}\n-----\n{}\n'.format(html, content)) self.assertRegex(content, r'alert-success') def setUp(self):