diff --git a/tests/conftest.py b/tests/conftest.py index b33178f..6efd787 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import os import shutil import pytest @@ -5,12 +6,15 @@ from utils import FIXTURES_DIR, TOX4 @pytest.fixture(autouse=True) -def projdir(tmp_path, monkeypatch): +def projdir(tmp_path, monkeypatch, worker_id): pwd = tmp_path / "projdir" pwd.mkdir() for fname in "tox.ini", "setup.py": shutil.copy(FIXTURES_DIR / fname, pwd) monkeypatch.chdir(pwd) + # https://github.com/pypa/pip/issues/5345#issuecomment-386424455 + monkeypatch.setenv("XDG_CACHE_HOME", + os.path.expanduser(f"~/.cache/pytest-xdist-{worker_id}")) return pwd diff --git a/tests/fixtures/tox.ini b/tests/fixtures/tox.ini index e218977..6d3f448 100644 --- a/tests/fixtures/tox.ini +++ b/tests/fixtures/tox.ini @@ -2,6 +2,8 @@ envlist = py36,py37,py38,py39,py310,py311 [testenv] +passenv = + XDG_CACHE_HOME deps = six py