Skip to content
Next Next commit
Update test_smtpnet.py from 3.13.11
  • Loading branch information
ShaharNaveh committed Dec 13, 2025
commit 949f10bb625aa0d8a8f9cc4a22c328e472092357
9 changes: 6 additions & 3 deletions Lib/test/test_smtpnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
from test import support
from test.support import import_helper
from test.support import socket_helper
import os
import smtplib
import socket

ssl = import_helper.import_module("ssl")

support.requires("network")

SMTP_TEST_SERVER = os.getenv('CPYTHON_TEST_SMTP_SERVER', 'smtp.gmail.com')

def check_ssl_verifiy(host, port):
context = ssl.create_default_context()
with socket.create_connection((host, port)) as sock:
Expand All @@ -22,7 +25,7 @@ def check_ssl_verifiy(host, port):


class SmtpTest(unittest.TestCase):
testServer = 'smtp.gmail.com'
testServer = SMTP_TEST_SERVER
remotePort = 587

def test_connect_starttls(self):
Expand All @@ -44,7 +47,7 @@ def test_connect_starttls(self):


class SmtpSSLTest(unittest.TestCase):
testServer = 'smtp.gmail.com'
testServer = SMTP_TEST_SERVER
remotePort = 465

def test_connect(self):
Expand Down Expand Up @@ -87,4 +90,4 @@ def test_connect_using_sslcontext_verified(self):


if __name__ == "__main__":
unittest.main()
unittest.main()
Loading