From 50a702f3fd87e271945aa5e88ae8a39d7a2149fd Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 9 Apr 2024 16:01:37 +0100 Subject: Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily. --- tests/logging_tests/tests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/logging_tests') diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index 747c929cde..610bdc1124 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -1,6 +1,7 @@ import logging from contextlib import contextmanager from io import StringIO +from unittest import mock from admin_scripts.tests import AdminScriptTestCase @@ -482,7 +483,12 @@ class AdminEmailHandlerTest(SimpleTestCase): None, None, ) - handler.emit(record) + with mock.patch.object( + handler, + "format_subject", + side_effect=AssertionError("Should not be called"), + ): + handler.emit(record) self.assertEqual(len(mail.outbox), 0) -- cgit v1.3