Commit ed8c28ee authored by Nadeem Vawda's avatar Nadeem Vawda

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.
parent 14e5ff80
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment