From b0085bbd97e353da9d859b574ea212abe8ef7e53 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Wed, 22 Aug 2018 02:50:58 -0400 Subject: [PATCH] configure cert bundle Signed-off-by: Dan Ryan --- run-tests.sh | 1 + tests/integration/conftest.py | 3 +++ tests/integration/test_dot_venv.py | 4 +++- tests/pytest-pypi/pytest_pypi/certs.py | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 64d79648..8c8f6c58 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -7,6 +7,7 @@ set -eo pipefail export PYTHONIOENCODING="utf-8" export LANG=C.UTF-8 export PIP_PROCESS_DEPENDENCY_LINKS="1" +export REQUESTS_CA_BUNDLE=$(readlink -f ./tests/pytest-pypi/pytest_pypi/certs/cacert.pem) prefix() { sed "s/^/ $1: /" diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index d8ac3686..5f1925b1 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -10,11 +10,14 @@ from pipenv.vendor import requests from pipenv.vendor import six from pipenv.vendor import toml from pytest_pypi.app import prepare_packages as prepare_pypi_packages +from pytest_pypi.certs import where as certs_where if six.PY2: class ResourceWarning(Warning): pass +os.environ["REQUESTS_CA_BUNDLE"] = certs_where() + HAS_WARNED_GITHUB = False def check_internet(): diff --git a/tests/integration/test_dot_venv.py b/tests/integration/test_dot_venv.py index 82e39e39..53f5fb1d 100644 --- a/tests/integration/test_dot_venv.py +++ b/tests/integration/test_dot_venv.py @@ -94,7 +94,9 @@ def test_venv_file_with_path(PipenvInstance, pypi): c = p.pipenv('install') assert c.return_code == 0 + c = p.pipenv('--venv') + assert c.return_code == 0 + venv_loc = Path(c.out.strip()) - venv_loc = Path(p.pipenv('--venv').out.strip()) assert venv_loc.joinpath('.project').exists() assert venv_loc == Path(venv_path.name) diff --git a/tests/pytest-pypi/pytest_pypi/certs.py b/tests/pytest-pypi/pytest_pypi/certs.py index c099cfa2..83133ea0 100644 --- a/tests/pytest-pypi/pytest_pypi/certs.py +++ b/tests/pytest-pypi/pytest_pypi/certs.py @@ -15,7 +15,7 @@ import os.path def where(): """Return the preferred certificate bundle.""" # vendored bundle inside Requests - return os.path.join(os.path.dirname(__file__), 'certs', 'cacert.pem') + return os.path.join(os.path.abspath(os.path.dirname(__file__), 'certs', 'cacert.pem')) if __name__ == '__main__': print(where())