From c16ef0a13e97dd04d1f4234f21ecda0627aaee8c Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Fri, 13 Jun 2025 11:45:47 -0700 Subject: [PATCH] PYTHON-5414 Add test for hostname verification error message regression (#2385) --- test/asynchronous/test_ssl.py | 4 +++- test/test_ssl.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_ssl.py b/test/asynchronous/test_ssl.py index 023ee9168..a05bc9379 100644 --- a/test/asynchronous/test_ssl.py +++ b/test/asynchronous/test_ssl.py @@ -323,7 +323,7 @@ class TestSSL(AsyncIntegrationTest): response = await self.client.admin.command(HelloCompat.LEGACY_CMD) - with self.assertRaises(ConnectionFailure): + with self.assertRaises(ConnectionFailure) as cm: await connected( self.simple_client( "server", @@ -335,6 +335,8 @@ class TestSSL(AsyncIntegrationTest): **self.credentials, # type: ignore[arg-type] ) ) + # PYTHON-5414 Check for "module service_identity has no attribute SICertificateError" + self.assertNotIn("has no attribute", str(cm.exception)) await connected( self.simple_client( diff --git a/test/test_ssl.py b/test/test_ssl.py index 93a4b4e6e..3ac0a4555 100644 --- a/test/test_ssl.py +++ b/test/test_ssl.py @@ -323,7 +323,7 @@ class TestSSL(IntegrationTest): response = self.client.admin.command(HelloCompat.LEGACY_CMD) - with self.assertRaises(ConnectionFailure): + with self.assertRaises(ConnectionFailure) as cm: connected( self.simple_client( "server", @@ -335,6 +335,8 @@ class TestSSL(IntegrationTest): **self.credentials, # type: ignore[arg-type] ) ) + # PYTHON-5414 Check for "module service_identity has no attribute SICertificateError" + self.assertNotIn("has no attribute", str(cm.exception)) connected( self.simple_client(