diff options
author | Mads Jensen <mje@inducks.org> | 2017-03-09 16:17:41 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-06-28 14:07:55 -0400 |
commit | 550cb3a365dee4edfdd1563224d5304de2a57fda (patch) | |
tree | fb532f38774ff7619edd2a4532c3daae1ee0ac5a /tests/mail | |
parent | 43a4835edf32c57eb74c0eb207c276734a34abcf (diff) | |
download | django-550cb3a365dee4edfdd1563224d5304de2a57fda.tar.gz |
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
Diffstat (limited to 'tests/mail')
-rw-r--r-- | tests/mail/tests.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py index 50922e21d7..e1a7feb1f9 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -8,6 +8,7 @@ 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 @@ -1123,12 +1124,10 @@ class ConsoleBackendTests(BaseEmailBackendTests, SimpleTestCase): class FakeSMTPChannel(smtpd.SMTPChannel): def collect_incoming_data(self, data): - try: + # Ignore decode error in SSL/TLS connection tests as the test only + # cares whether the connection attempt was made. + with suppress(UnicodeDecodeError): smtpd.SMTPChannel.collect_incoming_data(self, data) - except UnicodeDecodeError: - # ignore decode error in SSL/TLS connection tests as we only care - # whether the connection attempt was made - pass def smtp_AUTH(self, arg): if arg == 'CRAM-MD5': |