diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8f32c0824..8eac46c94 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -94,6 +94,7 @@ Stephen Finucane Sviatoslav Sydorenko Thomas Grainger Tim Laurence +Tyagraj Desigar Ville Skyttä Xander Johnson anatoly techtonik diff --git a/docs/changelog/1636.bugfix.rst b/docs/changelog/1636.bugfix.rst new file mode 100644 index 000000000..b9a994f9d --- /dev/null +++ b/docs/changelog/1636.bugfix.rst @@ -0,0 +1 @@ +Allow hyphens and empty factors in generative section name. - by :user:`tyagdit` diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py index c21222c04..891aa59af 100644 --- a/src/tox/config/__init__.py +++ b/src/tox/config/__init__.py @@ -1420,7 +1420,7 @@ def expand_section_names(config): The parser will see it as two different sections: [testenv:py36-cov], [testenv:py37-cov] """ - factor_re = re.compile(r"\{\s*([\w\s,]+)\s*\}") + factor_re = re.compile(r"\{\s*([\w\s,-]+)\s*\}") split_re = re.compile(r"\s*,\s*") to_remove = set() for section in list(config.sections): diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 14847c7a6..206fdc1c2 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -865,10 +865,11 @@ def test_getbool(self, newconfig): def test_expand_section_name(self, newconfig): config = newconfig( """ - [testenv:custom-{one,two,three}-{four,five}-six] + [testenv:custom{,-one,-two,-three}-{four,five}-six] """, ) assert "testenv:custom-one-five-six" in config._cfg.sections + assert "testenv:custom-four-six" in config._cfg.sections assert "testenv:custom-{one,two,three}-{four,five}-six" not in config._cfg.sections