Skip to content

Commit

Permalink
Fix space not accepted in factor filter expression
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 17, 2022
1 parent 9553e4f commit 852c346
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog/2718.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix space not accepted in factor filter expression - by :user:`gaborbernat`.
2 changes: 1 addition & 1 deletion src/tox/config/loader/ini/factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<factor_expr>[\w{}.!,-]+):\s+)?(?P<content>.*?)$", line)
match = re.match(r"^((?P<factor_expr>[\w {}.!,-]+):\s+)?(?P<content>.*?)$", line)
if match is None: # pragma: no cover
raise RuntimeError("for a valid factor regex this cannot happen")
groups = match.groupdict()
Expand Down
2 changes: 2 additions & 0 deletions tests/config/loader/ini/test_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
""",
Expand All @@ -46,6 +47,7 @@ def test_factor_env_discover(complex_example: str) -> None:
"pi-b",
"pi-b-dev",
"c",
"d",
"extra",
]

Expand Down

0 comments on commit 852c346

Please sign in to comment.