diff options
Diffstat (limited to 'Lib/test/test_smtpnet.py')
-rw-r--r-- | Lib/test/test_smtpnet.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py index b69cd9d..74a00a9 100644 --- a/Lib/test/test_smtpnet.py +++ b/Lib/test/test_smtpnet.py @@ -1,5 +1,6 @@ import unittest from test import support +from test.support import socket_helper import smtplib import socket @@ -28,7 +29,7 @@ class SmtpTest(unittest.TestCase): context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = False context.verify_mode = ssl.CERT_NONE - with support.transient_internet(self.testServer): + with socket_helper.transient_internet(self.testServer): server = smtplib.SMTP(self.testServer, self.remotePort) try: server.starttls(context=context) @@ -47,14 +48,14 @@ class SmtpSSLTest(unittest.TestCase): def test_connect(self): support.get_attribute(smtplib, 'SMTP_SSL') - with support.transient_internet(self.testServer): + with socket_helper.transient_internet(self.testServer): server = smtplib.SMTP_SSL(self.testServer, self.remotePort) server.ehlo() server.quit() def test_connect_default_port(self): support.get_attribute(smtplib, 'SMTP_SSL') - with support.transient_internet(self.testServer): + with socket_helper.transient_internet(self.testServer): server = smtplib.SMTP_SSL(self.testServer) server.ehlo() server.quit() @@ -64,20 +65,20 @@ class SmtpSSLTest(unittest.TestCase): context.check_hostname = False context.verify_mode = ssl.CERT_NONE support.get_attribute(smtplib, 'SMTP_SSL') - with support.transient_internet(self.testServer): + with socket_helper.transient_internet(self.testServer): server = smtplib.SMTP_SSL(self.testServer, self.remotePort, context=context) server.ehlo() server.quit() def test_connect_using_sslcontext_verified(self): - with support.transient_internet(self.testServer): + with socket_helper.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): + with socket_helper.transient_internet(self.testServer): server = smtplib.SMTP_SSL(self.testServer, self.remotePort, context=context) server.ehlo() server.quit() |