Skip to content

Commit 4d12e60

Browse files
committed
Move cryptography-based imports into fixture
Move the imports that require cryptography into the cert_factory fixture. This makes it possible to skip these tests on systems where cryptography cannot be installed due to its dependency on Rust.
1 parent c6037c7 commit 4d12e60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/conftest.py

Lines changed: 2 additions & 1 deletion
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,8 @@ def deprecated_python() -> bool:
551550

552551
@pytest.fixture(scope="session")
553552
def cert_factory(tmpdir_factory: pytest.TempdirFactory) -> CertFactory:
553+
from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
554+
554555
def factory() -> str:
555556
"""Returns path to cert/key file."""
556557
output_path = Path(str(tmpdir_factory.mktemp("certs"))) / "cert.pem"

0 commit comments

Comments
 (0)