From fdfb7d57059a43cf0041f5998a21e7d4bda1ab78 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Tue, 24 Jun 2025 13:47:26 -0400 Subject: [PATCH 1/2] PYTHON-5415 - Unskip tests that rely on server hostname --- .evergreen/scripts/setup-system.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.evergreen/scripts/setup-system.sh b/.evergreen/scripts/setup-system.sh index d8552e0ad2..9158414cce 100755 --- a/.evergreen/scripts/setup-system.sh +++ b/.evergreen/scripts/setup-system.sh @@ -38,4 +38,14 @@ if [ "$(uname -s)" = "Darwin" ]; then fi fi +if [ -w /etc/hosts ]; then + SUDO="" +else + SUDO="sudo" +fi + +# Add 'server' and 'hostname_not_in_cert' as a hostnames +echo "127.0.0.1 server" | $SUDO tee -a /etc/hosts +echo "127.0.0.1 hostname_not_in_cert" | $SUDO tee -a /etc/hosts + echo "Setting up system... done." From f2bd13ce67bc2f0f446192f0d9f09862ef229070 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 25 Jun 2025 14:31:45 -0400 Subject: [PATCH 2/2] Address failures --- test/asynchronous/test_ssl.py | 10 ++++++++++ test/test_ssl.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/asynchronous/test_ssl.py b/test/asynchronous/test_ssl.py index a05bc9379d..0ce3e8bbac 100644 --- a/test/asynchronous/test_ssl.py +++ b/test/asynchronous/test_ssl.py @@ -304,8 +304,13 @@ async def test_cert_ssl_uri_support(self): client = self.simple_client(uri_fmt % (CLIENT_PEM, "true", CA_PEM)) await self.assertClientWorks(client) + @unittest.skipIf( + "PyPy" in sys.version and not _IS_SYNC, + "https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF", + ) @async_client_context.require_tlsCertificateKeyFile @async_client_context.require_server_resolvable + @async_client_context.require_no_api_version @ignore_deprecations async def test_cert_ssl_validation_hostname_matching(self): # Expects the server to be running with server.pem and ca.pem @@ -430,8 +435,13 @@ async def test_tlsCRLFile_support(self): self.simple_client(uri_fmt % (CRL_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type] ) + @unittest.skipIf( + "PyPy" in sys.version and not _IS_SYNC, + "https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF", + ) @async_client_context.require_tlsCertificateKeyFile @async_client_context.require_server_resolvable + @async_client_context.require_no_api_version @ignore_deprecations async def test_validation_with_system_ca_certs(self): # Expects the server to be running with server.pem and ca.pem. diff --git a/test/test_ssl.py b/test/test_ssl.py index 3ac0a4555a..b1e9a65eb5 100644 --- a/test/test_ssl.py +++ b/test/test_ssl.py @@ -304,8 +304,13 @@ def test_cert_ssl_uri_support(self): client = self.simple_client(uri_fmt % (CLIENT_PEM, "true", CA_PEM)) self.assertClientWorks(client) + @unittest.skipIf( + "PyPy" in sys.version and not _IS_SYNC, + "https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF", + ) @client_context.require_tlsCertificateKeyFile @client_context.require_server_resolvable + @client_context.require_no_api_version @ignore_deprecations def test_cert_ssl_validation_hostname_matching(self): # Expects the server to be running with server.pem and ca.pem @@ -430,8 +435,13 @@ def test_tlsCRLFile_support(self): self.simple_client(uri_fmt % (CRL_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type] ) + @unittest.skipIf( + "PyPy" in sys.version and not _IS_SYNC, + "https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF", + ) @client_context.require_tlsCertificateKeyFile @client_context.require_server_resolvable + @client_context.require_no_api_version @ignore_deprecations def test_validation_with_system_ca_certs(self): # Expects the server to be running with server.pem and ca.pem.