summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-11-26 16:20:33 +0100
committerMichał Górny <mgorny@gentoo.org>2021-11-27 11:27:24 +0100
commit2f13337ce5da0e1990bbdf82158f75e497001a27 (patch)
treecbe02c64128803c82ee003d1efb7c9d57d7b7e25 /dev-python/pip/files
parentdev-python/GitPython: Keyword 3.1.24 for ~m68k (diff)
downloadgentoo-2f13337ce5da0e1990bbdf82158f75e497001a27.tar.gz
gentoo-2f13337ce5da0e1990bbdf82158f75e497001a27.tar.bz2
gentoo-2f13337ce5da0e1990bbdf82158f75e497001a27.zip
dev-python/pip: Skip cryptography tests when not available
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pip/files')
-rw-r--r--dev-python/pip/files/pip-21.3.1-cryptography-tests.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/dev-python/pip/files/pip-21.3.1-cryptography-tests.patch b/dev-python/pip/files/pip-21.3.1-cryptography-tests.patch
new file mode 100644
index 000000000000..1505d487ad40
--- /dev/null
+++ b/dev-python/pip/files/pip-21.3.1-cryptography-tests.patch
@@ -0,0 +1,39 @@
+From 8fa5d719a3c902ca9b6c9198229b7a67fecf8b8e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 26 Nov 2021 16:12:16 +0100
+Subject: [PATCH] Move cryptography-based imports into the fixture
+
+Move the imports that require cryptography into the cert_factory
+fixture. This makes it possible to deselect these tests on systems
+where cryptography cannot be installed.
+---
+ tests/conftest.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 076aeaf19..bab6ab3f5 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -27,7 +27,6 @@ from pip._internal.cli.main import main as pip_entry_point
+ from pip._internal.locations import _USE_SYSCONFIG
+ from pip._internal.utils.temp_dir import global_tempdir_manager
+ from tests.lib import DATA_DIR, SRC_DIR, PipTestEnvironment, TestData
+-from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
+ from tests.lib.path import Path
+ from tests.lib.server import MockServer as _MockServer
+ from tests.lib.server import make_mock_server, server_running
+@@ -535,6 +534,11 @@ def deprecated_python() -> bool:
+
+ @pytest.fixture(scope="session")
+ def cert_factory(tmpdir_factory: pytest.TempdirFactory) -> Callable[[], str]:
++ # Delay the import requiring cryptography in order to make it possible
++ # to deselect relevant tests on systems where cryptography cannot
++ # be installed.
++ from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
++
+ def factory() -> str:
+ """Returns path to cert/key file."""
+ output_path = Path(str(tmpdir_factory.mktemp("certs"))) / "cert.pem"
+--
+2.34.1
+