Skip to content

Commit 8e5dc4b

Browse files
committed
Skip cryptography-based tests when it is unavailable
Since the new versions of cryptography require Rust, it is no longer possible to reliably install them on systems missing Rust support. Given that only small subset of tests require certificates, skip them when cryptography is unavailable.
1 parent c6037c7 commit 8e5dc4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/conftest.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from pip._internal.locations import _USE_SYSCONFIG
2828
from pip._internal.utils.temp_dir import global_tempdir_manager
2929
from tests.lib import DATA_DIR, SRC_DIR, PipTestEnvironment, TestData
30-
from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
3130
from tests.lib.path import Path
3231
from tests.lib.server import MockServer as _MockServer
3332
from tests.lib.server import make_mock_server, server_running
@@ -551,6 +550,11 @@ def deprecated_python() -> bool:
551550

552551
@pytest.fixture(scope="session")
553552
def cert_factory(tmpdir_factory: pytest.TempdirFactory) -> CertFactory:
553+
try:
554+
from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
555+
except ImportError:
556+
pytest.skip("Cryptography is not available")
557+
554558
def factory() -> str:
555559
"""Returns path to cert/key file."""
556560
output_path = Path(str(tmpdir_factory.mktemp("certs"))) / "cert.pem"

0 commit comments

Comments
 (0)