diff --git a/docs/changelog/2634.bugfix.rst b/docs/changelog/2634.bugfix.rst new file mode 100644 index 000000000..8f0f94475 --- /dev/null +++ b/docs/changelog/2634.bugfix.rst @@ -0,0 +1,2 @@ +Fix tox auto-provisioning not working and relax :ref:`min_version` default from ``4.0`` to no version constraint +- by user:`gaborbernat`. diff --git a/docs/changelog/2720.bugfix.rst b/docs/changelog/2720.bugfix.rst index f450e752a..a87bf6825 100644 --- a/docs/changelog/2720.bugfix.rst +++ b/docs/changelog/2720.bugfix.rst @@ -1,2 +1,2 @@ -Fix assertion in ``test_result_json_sequential`` when interpreter -``_base_executable`` is a hardlink (macOS homebrew) - by user:`masenf` +Fix assertion in ``test_result_json_sequential`` when interpreter ``_base_executable`` is a hardlink (macOS homebrew) +- by user:`masenf`. diff --git a/docs/changelog/2747.bugfix.rst b/docs/changelog/2747.bugfix.rst new file mode 100644 index 000000000..f0137074c --- /dev/null +++ b/docs/changelog/2747.bugfix.rst @@ -0,0 +1 @@ +Complex negative factor filters not working - by user:`gaborbernat`. diff --git a/src/tox/config/loader/ini/factor.py b/src/tox/config/loader/ini/factor.py index bc121a651..e13b5ec95 100644 --- a/src/tox/config/loader/ini/factor.py +++ b/src/tox/config/loader/ini/factor.py @@ -67,6 +67,9 @@ def find_factor_groups(value: str) -> Iterator[list[tuple[str, bool]]]: yield result +_FACTOR_RE = re.compile(r"!?[\w._][\w._-]*") + + def expand_env_with_negation(value: str) -> Iterator[str]: """transform '{py,!pi}-{a,b},c' to ['py-a', 'py-b', '!pi-a', '!pi-b', 'c']""" for key, group in groupby(re.split(r"((?:{[^}]+})+)|,", value), key=bool): @@ -76,7 +79,7 @@ def expand_env_with_negation(value: str) -> Iterator[str]: parts = [[i.strip() for i in elem.split(",")] for elem in elements] for variant in product(*parts): variant_str = "".join(variant) - if not re.fullmatch(r"!?[\w._][\w._-]*", variant_str): + if not all(_FACTOR_RE.fullmatch(i) for i in variant_str.split("-")): raise ValueError(variant_str) yield variant_str diff --git a/tests/config/loader/ini/test_factor.py b/tests/config/loader/ini/test_factor.py index 0a4e025a2..00aa83c94 100644 --- a/tests/config/loader/ini/test_factor.py +++ b/tests/config/loader/ini/test_factor.py @@ -122,6 +122,8 @@ def test_factor_config(tox_ini_conf: ToxIniCreator) -> None: django15: Django>=1.5,<1.6 django16: Django>=1.6,<1.7 py36: unittest2 + !py37,!django16: negation-or + !py37-!django16: negation-and """, ) assert list(config) == ["py36-django15", "py36-django16", "py37-django15", "py37-django16"] @@ -132,10 +134,14 @@ def test_factor_config(tox_ini_conf: ToxIniCreator) -> None: assert "pytest" in deps if "py36" in env: assert "unittest2" in deps + assert "negation-or" in deps if "django15" in env: assert "Django>=1.5,<1.6" in deps + assert "negation-or" in deps if "django16" in env: assert "Django>=1.6,<1.7" in deps + if "py36-django15" == env_config.name: + assert "negation-and" in deps def test_factor_config_do_not_replace_unescaped_comma(tox_ini_conf: ToxIniCreator) -> None: