From 670a4eaa88d3a7a97892d6fa4413f250c8f64a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 17 Dec 2022 11:38:43 -0800 Subject: [PATCH] Fix space not accepted in factor filter expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2718.bugfix.rst | 1 + src/tox/config/loader/ini/factor.py | 2 +- tests/config/loader/ini/test_factor.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2718.bugfix.rst diff --git a/docs/changelog/2718.bugfix.rst b/docs/changelog/2718.bugfix.rst new file mode 100644 index 000000000..02e3cab8b --- /dev/null +++ b/docs/changelog/2718.bugfix.rst @@ -0,0 +1 @@ +Fix space not accepted in factor filter expression - by :user:`gaborbernat`. diff --git a/src/tox/config/loader/ini/factor.py b/src/tox/config/loader/ini/factor.py index 1c6f59fd7..3f547775b 100644 --- a/src/tox/config/loader/ini/factor.py +++ b/src/tox/config/loader/ini/factor.py @@ -48,7 +48,7 @@ def explode_factor(group: list[tuple[str, bool]]) -> str: def expand_factors(value: str) -> Iterator[tuple[Iterator[list[tuple[str, bool]]] | None, str]]: for line in value.split("\n"): - match = re.match(r"^((?P[\w{}.!,-]+):\s+)?(?P.*?)$", line) + match = re.match(r"^((?P[\w {}.!,-]+):\s+)?(?P.*?)$", line) if match is None: # pragma: no cover raise RuntimeError("for a valid factor regex this cannot happen") groups = match.groupdict() diff --git a/tests/config/loader/ini/test_factor.py b/tests/config/loader/ini/test_factor.py index 29c70a482..0a4e025a2 100644 --- a/tests/config/loader/ini/test_factor.py +++ b/tests/config/loader/ini/test_factor.py @@ -27,6 +27,7 @@ def complex_example() -> str: py: py only !py: not py {py,!pi}-{a,b}{,-dev},c: complex + py, d: space extra: extra more-default """, @@ -46,6 +47,7 @@ def test_factor_env_discover(complex_example: str) -> None: "pi-b", "pi-b-dev", "c", + "d", "extra", ]