mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-23 08:36:15 +01:00
Only use old virtualenv with old tox
Fixes https://github.com/fedora-python/tox-current-env/issues/74
This commit is contained in:
parent
0c125a3c7f
commit
0cf27856f8
1
setup.py
1
setup.py
@ -27,7 +27,6 @@ setup(
|
||||
"pytest",
|
||||
"pytest-xdist",
|
||||
"packaging",
|
||||
"virtualenv<20.22", # pin required for tests with Python 3.6 envs
|
||||
],
|
||||
},
|
||||
python_requires=">=3.6",
|
||||
|
@ -2,7 +2,7 @@ import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
from utils import FIXTURES_DIR, TOX4
|
||||
from utils import FIXTURES_DIR, TOX4, modify_config, drop_unsupported_pythons
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@ -11,6 +11,9 @@ def projdir(tmp_path, monkeypatch, worker_id):
|
||||
pwd.mkdir()
|
||||
for fname in "tox.ini", "setup.py", "pyproject.toml":
|
||||
shutil.copy(FIXTURES_DIR / fname, pwd)
|
||||
if TOX4:
|
||||
with modify_config(pwd / "tox.ini") as config:
|
||||
config["tox"]["envlist"] = drop_unsupported_pythons(config["tox"]["envlist"])
|
||||
monkeypatch.chdir(pwd)
|
||||
# https://github.com/pypa/pip/issues/5345#issuecomment-386424455
|
||||
monkeypatch.setenv("XDG_CACHE_HOME",
|
||||
|
@ -83,11 +83,17 @@ def is_available(python):
|
||||
return True
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def drop_unsupported_pythons(envlist):
|
||||
return envlist[len("py36,py37,"):] if TOX4 else envlist
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def envs_from_tox_ini():
|
||||
cp = ConfigParser()
|
||||
cp.read(FIXTURES_DIR / "tox.ini")
|
||||
return cp["tox"]["envlist"].split(",")
|
||||
envlist = drop_unsupported_pythons(cp["tox"]["envlist"])
|
||||
return envlist.split(",")
|
||||
|
||||
|
||||
def tox_footer(envs=None, spaces=8):
|
||||
|
Loading…
Reference in New Issue
Block a user