summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBernát Gábor <gaborjbernat@gmail.com>2022-12-18 08:19:38 -0800
committerGitHub <noreply@github.com>2022-12-18 08:19:38 -0800
commit569268a4bd34bddfceadcccaed6bd8e0cc9316f4 (patch)
tree3e22bf8279da4a7f96501855aee25e07c40ddc8e /src
parent50985fe1bbb44f8126cc3f52d3a3079b0b80dc55 (diff)
downloadtox-git-569268a4bd34bddfceadcccaed6bd8e0cc9316f4.tar.gz
Ignore non-test section names and invalid factor filters (#2748)
Resolves https://github.com/tox-dev/tox/issues/2746
Diffstat (limited to 'src')
-rw-r--r--src/tox/config/loader/ini/factor.py2
-rw-r--r--src/tox/config/source/ini.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/tox/config/loader/ini/factor.py b/src/tox/config/loader/ini/factor.py
index 731fe610..bc121a65 100644
--- a/src/tox/config/loader/ini/factor.py
+++ b/src/tox/config/loader/ini/factor.py
@@ -73,7 +73,7 @@ def expand_env_with_negation(value: str) -> Iterator[str]:
if key:
group_str = "".join(group).strip()
elements = re.split(r"{([^}]+)}", group_str)
- parts = [re.sub(r"\s+", "", elem).split(",") for elem in elements]
+ 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):
diff --git a/src/tox/config/source/ini.py b/src/tox/config/source/ini.py
index ee3ed77c..f3e0c083 100644
--- a/src/tox/config/source/ini.py
+++ b/src/tox/config/source/ini.py
@@ -83,9 +83,9 @@ class IniSource(Source):
# discover all additional defined environments, including generative section headers
for section in self.sections():
- register_factors(section.names)
- for name in section.names:
- if section.is_test_env:
+ if section.is_test_env:
+ register_factors(section.names)
+ for name in section.names:
self._section_mapping[name].append(section.key)
yield name
# add all conditional markers that are not part of the explicitly defined sections