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.
This commit is contained in:
Victor Stinner 2014-09-04 00:35:43 +02:00
parent 2bb8a08159
commit 19c899c1b1
1 changed files with 5 additions and 2 deletions

View File

@ -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):