diff options
author | Tim Graham <timograham@gmail.com> | 2017-09-07 08:16:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-07 08:16:21 -0400 |
commit | 6e4c6281dbb7ee12bcdc22620894edb4e9cf623f (patch) | |
tree | 1c21218d4b6f00c499f18943d5190ebe7b5248c9 /tests/mail | |
parent | 8b2515a450ef376b9205029090af0a79c8341bd7 (diff) | |
download | django-6e4c6281dbb7ee12bcdc22620894edb4e9cf623f.tar.gz |
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda
because try/except performs better.
Diffstat (limited to 'tests/mail')
-rw-r--r-- | tests/mail/tests.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py index b759484e04..29a56d6e74 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -8,7 +8,6 @@ import socket import sys import tempfile import threading -from contextlib import suppress from email import message_from_binary_file, message_from_bytes from email.header import Header from email.mime.text import MIMEText @@ -1135,10 +1134,12 @@ class ConsoleBackendTests(BaseEmailBackendTests, SimpleTestCase): class FakeSMTPChannel(smtpd.SMTPChannel): def collect_incoming_data(self, data): - # Ignore decode error in SSL/TLS connection tests as the test only - # cares whether the connection attempt was made. - with suppress(UnicodeDecodeError): + try: smtpd.SMTPChannel.collect_incoming_data(self, data) + except UnicodeDecodeError: + # Ignore decode error in SSL/TLS connection tests as the test only + # cares whether the connection attempt was made. + pass def smtp_AUTH(self, arg): if arg == 'CRAM-MD5': |