mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2025-01-11 00:46:15 +01:00
Avoid race conditions when running tests with xdist
This commit is contained in:
parent
f71dd2a238
commit
028ee0cfb4
@ -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
|
||||
|
||||
|
||||
|
2
tests/fixtures/tox.ini
vendored
2
tests/fixtures/tox.ini
vendored
@ -2,6 +2,8 @@
|
||||
envlist = py36,py37,py38,py39,py310,py311
|
||||
|
||||
[testenv]
|
||||
passenv =
|
||||
XDG_CACHE_HOME
|
||||
deps =
|
||||
six
|
||||
py
|
||||
|
Loading…
Reference in New Issue
Block a user