[Python-checkins] cpython (3.4): Issue #20957: test_smtpnet now uses support.transient_internet() to call

victor.stinner python-checkins at python.org
Thu Sep 4 00:36:27 CEST 2014


http://hg.python.org/cpython/rev/b7200cde1b68
changeset:   92314:b7200cde1b68
branch:      3.4
parent:      92312:db9eb9cba1ec
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Sep 04 00:35:43 2014 +0200
summary:
  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.

files:
  Lib/test/test_smtpnet.py |  7 +++++--
  1 files changed, 5 insertions(+), 2 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
@@ -42,7 +42,6 @@
 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 @@
             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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list