diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-12-21 17:19:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-21 17:19:31 +0000 |
| commit | bc787b2da64ab3dbe5bb9c5966ff411dc8a41705 (patch) | |
| tree | 7583278df1f2b3594bba23ea2c4ec93600a31f84 | |
| parent | 838bfbc420277e823d6ce7f881773132933eecad (diff) | |
| download | virtualenv-bc787b2da64ab3dbe5bb9c5966ff411dc8a41705.tar.gz | |
Try to fix the CI (#2041)
| -rw-r--r-- | tasks/make_zipapp.py | 2 | ||||
| -rw-r--r-- | tests/conftest.py | 35 |
2 files changed, 33 insertions, 4 deletions
diff --git a/tasks/make_zipapp.py b/tasks/make_zipapp.py index a58a821..7eceb50 100644 --- a/tasks/make_zipapp.py +++ b/tasks/make_zipapp.py @@ -201,7 +201,7 @@ class WheelDownloader(object): shutil.copytree( str(target), str(folder), - ignore=shutil.ignore_patterns(".tox", "venv", "__pycache__", "*.pyz"), + ignore=shutil.ignore_patterns(".tox", ".tox4", "venv", "__pycache__", "*.pyz"), ) try: return self._build_sdist(self.into, folder) diff --git a/tests/conftest.py b/tests/conftest.py index 5fab330..b2317fc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -129,9 +129,38 @@ def ensure_py_info_cache_empty(session_app_data): PythonInfo.clear_cache(session_app_data) -@pytest.fixture(autouse=True) -def ignore_global_config(tmp_path, monkeypatch): - monkeypatch.setenv(ensure_str("VIRTUALENV_CONFIG_FILE"), str(tmp_path / "this-should-never-exist")) +@contextmanager +def change_os_environ(key, value): + env_var = key + previous = os.environ[env_var] if env_var in os.environ else None + os.environ[env_var] = value + try: + yield + finally: + if previous is not None: + os.environ[env_var] = previous + + +@pytest.fixture(autouse=True, scope="session") +def ignore_global_config(tmp_path_factory): + filename = str(tmp_path_factory.mktemp("folder") / "virtualenv-test-suite.ini") + with change_os_environ(ensure_str("VIRTUALENV_CONFIG_FILE"), filename): + yield + + +@pytest.fixture(autouse=True, scope="session") +def pip_cert(tmp_path_factory): + # workaround for https://github.com/pypa/pip/issues/8984 - if the certificate is explicitly set no error can happen + key = ensure_str("PIP_CERT") + if key in os.environ: + return + cert = tmp_path_factory.mktemp("folder") / "cert" + import pkgutil + + cert_data = pkgutil.get_data("pip._vendor.certifi", "cacert.pem") + cert.write_bytes(cert_data) + with change_os_environ(key, str(cert)): + yield @pytest.fixture(autouse=True) |
