summaryrefslogtreecommitdiff
path: root/src/mailman/runners/tests/test_lmtp.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-10-31 17:31:12 +0100
committerBarry Warsaw2012-10-31 17:31:12 +0100
commita9464c14fc6dfc23613a1ec89446393fe6476f88 (patch)
tree74a926cfe64066ebffcf9adb89e7672289173d84 /src/mailman/runners/tests/test_lmtp.py
parenta1666479d87e26e5c79dd1cf507b8ef0472c59aa (diff)
downloadmailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.gz
mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.zst
mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.zip
* Python 2.7 is not required. Python 2.6 is no longer officially supported.
The code base is now also `python2.7 -3` clean, although there are still some warnings in 3rd party dependencies. LP: #1073506
Diffstat (limited to 'src/mailman/runners/tests/test_lmtp.py')
-rw-r--r--src/mailman/runners/tests/test_lmtp.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mailman/runners/tests/test_lmtp.py b/src/mailman/runners/tests/test_lmtp.py
index 46d4ed986..a502c317d 100644
--- a/src/mailman/runners/tests/test_lmtp.py
+++ b/src/mailman/runners/tests/test_lmtp.py
@@ -53,22 +53,19 @@ class TestLMTP(unittest.TestCase):
def test_message_id_required(self):
# The message is rejected if it does not have a Message-ID header.
- try:
+ with self.assertRaises(smtplib.SMTPDataError) as cm:
self._lmtp.sendmail('anne@example.com', ['test@example.com'], """\
From: anne@example.com
To: test@example.com
Subject: This has no Message-ID header
""")
- except smtplib.SMTPDataError as error:
- pass
- else:
- raise AssertionError('SMTPDataError expected')
# LMTP returns a 550: Requested action not taken: mailbox unavailable
# (e.g., mailbox not found, no access, or command rejected for policy
# reasons)
- self.assertEqual(error.smtp_code, 550)
- self.assertEqual(error.smtp_error, 'No Message-ID header provided')
+ self.assertEqual(cm.exception.smtp_code, 550)
+ self.assertEqual(cm.exception.smtp_error,
+ 'No Message-ID header provided')
def test_message_id_hash_is_added(self):
self._lmtp.sendmail('anne@example.com', ['test@example.com'], """\