Skip to content

Commit

Permalink
Try to fix the CI
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 21, 2020
1 parent 838bfbc commit 83f70dd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tasks/make_zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def build_sdist(self, target):
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)
Expand Down
35 changes: 32 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ commands =
python -m coverage erase
python -m coverage run -m pytest \
--junitxml {toxworkdir}/junit.{envname}.xml \
{posargs:tests --int --timeout 600 -n {env:PYTEST_XDIST:auto}}
{posargs:tests --int --timeout 600 -n 0}
python -m coverage combine
python -m coverage report --skip-covered --show-missing
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
Expand Down

0 comments on commit 83f70dd

Please sign in to comment.