[Python-checkins] cpython: test_smtpnet: Skip STARTTLS test if the server doesn't support it.

nadeem.vawda python-checkins at python.org
Sat Jul 30 23:48:02 CEST 2011


http://hg.python.org/cpython/rev/a6808417565c
changeset: 71644:a6808417565c
parent: 71642:b47c9982506c
user: Nadeem Vawda <nadeem.vawda at gmail.com>
date: Sat Jul 30 23:46:54 2011 +0200
summary:
 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.
files:
 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
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -18,7 +18,13 @@
 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()
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /