summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-09-03 22:36:09 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-09-03 22:36:09 (GMT)
commitcde45171128767cb85054e378b4bff71f8ede9a7 (patch)
tree33d65641e329892049fae33b3e2d9411f911d501
parente96c83bde1fe7cc8e4813cb92ee522ca2f477844 (diff)
parent19c899c1b143a4d1de09d6dad73e8b10e28ab037 (diff)
downloadcpython-cde45171128767cb85054e378b4bff71f8ede9a7.zip
cpython-cde45171128767cb85054e378b4bff71f8ede9a7.tar.gz
cpython-cde45171128767cb85054e378b4bff71f8ede9a7.tar.bz2
(Merge 3.4) Issue #20957: test_smtpnet now uses support.transient_internet() to
call check_ssl_verifiy(), so only test_connect_using_sslcontext_verified() is skipped if smtp.gmail.com cannot be joined, not the whole file.
-rw-r--r--Lib/test/test_smtpnet.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
index 7f9db2d..03bf93b 100644
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -42,7 +42,6 @@ class SmtpTest(unittest.TestCase):
class SmtpSSLTest(unittest.TestCase):
testServer = 'smtp.gmail.com'
remotePort = 465
- can_verify = check_ssl_verifiy(testServer, remotePort)
def test_connect(self):
support.get_attribute(smtplib, 'SMTP_SSL')
@@ -66,8 +65,12 @@ class SmtpSSLTest(unittest.TestCase):
server.ehlo()
server.quit()
- @unittest.skipUnless(can_verify, "SSL certificate can't be verified")
def test_connect_using_sslcontext_verified(self):
+ with support.transient_internet(self.testServer):
+ can_verify = check_ssl_verifiy(self.testServer, self.remotePort)
+ if not can_verify:
+ self.skipTest("SSL certificate can't be verified")
+
support.get_attribute(smtplib, 'SMTP_SSL')
context = ssl.create_default_context()
with support.transient_internet(self.testServer):