mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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
1 changed files with 7 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue