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.
This commit is contained in:
parent
6e3b975aa5
commit
3fc5868a1d
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue