diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-07-30 21:46:54 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-07-30 21:46:54 (GMT) |
commit | 3fc5868a1d123996936c2feb6625865f5bb88b37 (patch) | |
tree | 516aa7ba035672f1d4aa8e446e35a0cf0f2d3131 /Lib/test/test_smtpnet.py | |
parent | 6e3b975aa525ef8f824e6258d89fb8dc2c4508c2 (diff) | |
download | cpython-3fc5868a1d123996936c2feb6625865f5bb88b37.zip cpython-3fc5868a1d123996936c2feb6625865f5bb88b37.tar.gz cpython-3fc5868a1d123996936c2feb6625865f5bb88b37.tar.bz2 |
test_smtpnet: Skip STARTTLS test if the server doesn't support it.
This issue can arise with ISPs that redirect all connections on port 25 to
their own (crappy) mail servers.
Diffstat (limited to 'Lib/test/test_smtpnet.py')
-rw-r--r-- | Lib/test/test_smtpnet.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py index 7d0fa98..86224ef 100644 --- a/Lib/test/test_smtpnet.py +++ b/Lib/test/test_smtpnet.py @@ -18,7 +18,13 @@ class SmtpTest(unittest.TestCase): support.get_attribute(smtplib, 'SMTP_SSL') with support.transient_internet(self.testServer): server = smtplib.SMTP(self.testServer, self.remotePort) - server.starttls(context=self.context) + try: + server.starttls(context=self.context) + except smtplib.SMTPException as e: + if e.args[0] == 'STARTTLS extension not supported by server.': + unittest.skip(e.args[0]) + else: + raise server.ehlo() server.quit() |