fix pyopenssl and numpy

This commit is contained in:
Steven Silvester 2026-02-11 07:42:35 -06:00
parent 14993d3303
commit 34f15fd34f
No known key found for this signature in database
5 changed files with 11 additions and 32 deletions

View File

@ -250,6 +250,7 @@ functions:
working_dir: src
include_expansions_in_env:
- TOOLCHAIN_VERSION
- COVERAGE
type: test
# Upload coverage codecov

View File

@ -1246,7 +1246,7 @@ def create_run_tests_func():
def create_test_numpy_func():
includes = ["TOOLCHAIN_VERSION"]
includes = ["TOOLCHAIN_VERSION", "COVERAGE"]
test_cmd = get_subprocess_exec(
include_expansions_in_env=includes, args=[".evergreen/just.sh", "test-numpy"]
)

View File

@ -61,7 +61,11 @@ test *args="-v --durations=5 --maxfail=10": && resync
[group('test')]
test-numpy: && resync
uv run --extra test --with numpy python -m pytest test/test_bson.py
if [ "{{COVERAGE}}" = "1" ]; then \
uv run --extra test --group coverage --with numpy python -m pytest --cov test/test_bson.py; \
else \
uv run --extra test --with numpy python -m pytest test/test_bson.py; \
fi
[group('test')]
run-tests *args: && resync

View File

@ -48,19 +48,11 @@ from pymongo.write_concern import WriteConcern
_HAVE_PYOPENSSL = False
try:
# All of these must be available to use PyOpenSSL
import OpenSSL
import requests
import service_identity
# Ensure service_identity>=18.1 is installed
from service_identity.pyopenssl import verify_ip_address
from pymongo.ocsp_support import _load_trusted_ca_certs
from pymongo import pyopenssl_context
_HAVE_PYOPENSSL = True
except ImportError:
_load_trusted_ca_certs = None # type: ignore
pass
if HAVE_SSL:
@ -136,11 +128,6 @@ class TestClientSSL(AsyncPyMongoTestCase):
def test_use_pyopenssl_when_available(self):
self.assertTrue(HAVE_PYSSL)
@unittest.skipUnless(_HAVE_PYOPENSSL, "Cannot test without PyOpenSSL")
def test_load_trusted_ca_certs(self):
trusted_ca_certs = _load_trusted_ca_certs(CA_BUNDLE_PEM)
self.assertEqual(2, len(trusted_ca_certs))
class TestSSL(AsyncIntegrationTest):
saved_port: int

View File

@ -48,19 +48,11 @@ from pymongo.write_concern import WriteConcern
_HAVE_PYOPENSSL = False
try:
# All of these must be available to use PyOpenSSL
import OpenSSL
import requests
import service_identity
# Ensure service_identity>=18.1 is installed
from service_identity.pyopenssl import verify_ip_address
from pymongo.ocsp_support import _load_trusted_ca_certs
from pymongo import pyopenssl_context
_HAVE_PYOPENSSL = True
except ImportError:
_load_trusted_ca_certs = None # type: ignore
pass
if HAVE_SSL:
@ -136,11 +128,6 @@ class TestClientSSL(PyMongoTestCase):
def test_use_pyopenssl_when_available(self):
self.assertTrue(HAVE_PYSSL)
@unittest.skipUnless(_HAVE_PYOPENSSL, "Cannot test without PyOpenSSL")
def test_load_trusted_ca_certs(self):
trusted_ca_certs = _load_trusted_ca_certs(CA_BUNDLE_PEM)
self.assertEqual(2, len(trusted_ca_certs))
class TestSSL(IntegrationTest):
saved_port: int