Skip to content

Commit bc787b2

Browse files
authored
Try to fix the CI (#2041)
1 parent 838bfbc commit bc787b2

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

tasks/make_zipapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def build_sdist(self, target):
201201
shutil.copytree(
202202
str(target),
203203
str(folder),
204-
ignore=shutil.ignore_patterns(".tox", "venv", "__pycache__", "*.pyz"),
204+
ignore=shutil.ignore_patterns(".tox", ".tox4", "venv", "__pycache__", "*.pyz"),
205205
)
206206
try:
207207
return self._build_sdist(self.into, folder)

tests/conftest.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,38 @@ def ensure_py_info_cache_empty(session_app_data):
129129
PythonInfo.clear_cache(session_app_data)
130130

131131

132-
@pytest.fixture(autouse=True)
133-
def ignore_global_config(tmp_path, monkeypatch):
134-
monkeypatch.setenv(ensure_str("VIRTUALENV_CONFIG_FILE"), str(tmp_path / "this-should-never-exist"))
132+
@contextmanager
133+
def change_os_environ(key, value):
134+
env_var = key
135+
previous = os.environ[env_var] if env_var in os.environ else None
136+
os.environ[env_var] = value
137+
try:
138+
yield
139+
finally:
140+
if previous is not None:
141+
os.environ[env_var] = previous
142+
143+
144+
@pytest.fixture(autouse=True, scope="session")
145+
def ignore_global_config(tmp_path_factory):
146+
filename = str(tmp_path_factory.mktemp("folder") / "virtualenv-test-suite.ini")
147+
with change_os_environ(ensure_str("VIRTUALENV_CONFIG_FILE"), filename):
148+
yield
149+
150+
151+
@pytest.fixture(autouse=True, scope="session")
152+
def pip_cert(tmp_path_factory):
153+
# workaround for https://github.com/pypa/pip/issues/8984 - if the certificate is explicitly set no error can happen
154+
key = ensure_str("PIP_CERT")
155+
if key in os.environ:
156+
return
157+
cert = tmp_path_factory.mktemp("folder") / "cert"
158+
import pkgutil
159+
160+
cert_data = pkgutil.get_data("pip._vendor.certifi", "cacert.pem")
161+
cert.write_bytes(cert_data)
162+
with change_os_environ(key, str(cert)):
163+
yield
135164

136165

137166
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)