Skip to content

PYTHON-5341 Fix handling of SSL tests with Stable API #2305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/asynchronous/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ async def asyncTearDown(self):

@async_client_context.require_tls
async def test_simple_ssl(self):
if "PyPy" in sys.version:
self.skipTest("Test is flaky on PyPy")
# Expects the server to be running with ssl and with
# no --sslPEMKeyFile or with --sslWeakCertificateValidation
await self.assertClientWorks(self.client)

@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_tlsCertificateKeyFilePassword(self):
# Expects the server to be running with server.pem and ca.pem
Expand Down Expand Up @@ -376,6 +379,7 @@ async def test_cert_ssl_validation_hostname_matching(self):
)

@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_tlsCRLFile_support(self):
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _ssl.IS_PYOPENSSL:
Expand Down Expand Up @@ -531,6 +535,7 @@ def test_wincertstore(self):

@async_client_context.require_auth
@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_mongodb_x509_auth(self):
host, port = await async_client_context.host, await async_client_context.port
Expand Down Expand Up @@ -640,6 +645,7 @@ async def test_mongodb_x509_auth(self):
self.fail("Invalid certificate accepted.")

@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_connect_with_ca_bundle(self):
def remove(path):
Expand Down
6 changes: 6 additions & 0 deletions test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ def tearDown(self):

@client_context.require_tls
def test_simple_ssl(self):
if "PyPy" in sys.version:
self.skipTest("Test is flaky on PyPy")
# Expects the server to be running with ssl and with
# no --sslPEMKeyFile or with --sslWeakCertificateValidation
self.assertClientWorks(self.client)

@client_context.require_tlsCertificateKeyFile
@client_context.require_no_api_version
@ignore_deprecations
def test_tlsCertificateKeyFilePassword(self):
# Expects the server to be running with server.pem and ca.pem
Expand Down Expand Up @@ -376,6 +379,7 @@ def test_cert_ssl_validation_hostname_matching(self):
)

@client_context.require_tlsCertificateKeyFile
@client_context.require_no_api_version
@ignore_deprecations
def test_tlsCRLFile_support(self):
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _ssl.IS_PYOPENSSL:
Expand Down Expand Up @@ -531,6 +535,7 @@ def test_wincertstore(self):

@client_context.require_auth
@client_context.require_tlsCertificateKeyFile
@client_context.require_no_api_version
@ignore_deprecations
def test_mongodb_x509_auth(self):
host, port = client_context.host, client_context.port
Expand Down Expand Up @@ -640,6 +645,7 @@ def test_mongodb_x509_auth(self):
self.fail("Invalid certificate accepted.")

@client_context.require_tlsCertificateKeyFile
@client_context.require_no_api_version
@ignore_deprecations
def test_connect_with_ca_bundle(self):
def remove(path):
Expand Down
Loading