diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-11-27 10:58:12 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-11-27 11:27:26 +0100 |
commit | 3c8b7b7f3b9952668ebc9aa50c009db2e641ae0f (patch) | |
tree | 46c3e5fa1c81cb04ab6c6944d163726ddd10175b /dev-python/requests | |
parent | dev-python/cheroot: Make SSL-related test-dep non-obligatory (diff) | |
download | gentoo-3c8b7b7f3b9952668ebc9aa50c009db2e641ae0f.tar.gz gentoo-3c8b7b7f3b9952668ebc9aa50c009db2e641ae0f.tar.bz2 gentoo-3c8b7b7f3b9952668ebc9aa50c009db2e641ae0f.zip |
dev-python/requests: Support running tests without trustme
In preperation for trustme losing keywords due to Rust requirement, make
it possible to run the vast majority of requests' tests without it (only
one test requires the dependency).
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/requests')
-rw-r--r-- | dev-python/requests/files/requests-2.26.0-trustme-dep.patch | 37 | ||||
-rw-r--r-- | dev-python/requests/requests-2.26.0.ebuild | 5 |
2 files changed, 40 insertions, 2 deletions
diff --git a/dev-python/requests/files/requests-2.26.0-trustme-dep.patch b/dev-python/requests/files/requests-2.26.0-trustme-dep.patch new file mode 100644 index 000000000000..b3a81659a9be --- /dev/null +++ b/dev-python/requests/files/requests-2.26.0-trustme-dep.patch @@ -0,0 +1,37 @@ +From 6a1b5cbc124e0c3362ddefae5939db5c216a74db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sat, 27 Nov 2021 10:33:35 +0100 +Subject: [PATCH] Skip the test requiring trustme when it is not available + +Modify the nosan_server fixture to cause test_https_warnings to be +skipped when trustme is not installed on the system, rather than causing +the whole test suite to fail unconditionally. This makes it possible +to run all the remaining tests on systems where trustme cannot be +installed due to its dependencies. +--- + tests/conftest.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 099462cf..5d38f254 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -13,7 +13,6 @@ import threading + + import pytest + from requests.compat import urljoin +-import trustme + + + def prepare_url(value): +@@ -38,6 +37,7 @@ def httpbin_secure(httpbin_secure): + + @pytest.fixture + def nosan_server(tmp_path_factory): ++ trustme = pytest.importorskip('trustme') + tmpdir = tmp_path_factory.mktemp("certs") + ca = trustme.CA() + # only commonName, no subjectAltName +-- +2.34.1 + diff --git a/dev-python/requests/requests-2.26.0.ebuild b/dev-python/requests/requests-2.26.0.ebuild index 911ddfa1be0d..d30d1f190284 100644 --- a/dev-python/requests/requests-2.26.0.ebuild +++ b/dev-python/requests/requests-2.26.0.ebuild @@ -39,10 +39,11 @@ distutils_enable_tests pytest PATCHES=( "${FILESDIR}"/${P}-test.patch + "${FILESDIR}"/${P}-trustme-dep.patch ) python_test() { - local deselect=( + local EPYTEST_DESELECT=( # Internet requests/__init__.py::requests requests/api.py::requests.api.request @@ -55,5 +56,5 @@ python_test() { tests/test_requests.py::TestRequests::test_pyopenssl_redirect ) - epytest ${deselect[@]/#/--deselect } + epytest } |