Skip to content

Commit 305d71a

Browse files
andreifgaborbernat
authored andcommitted
Skip whitespace in envstr. (tox-dev#670)
* Skip whitespace in envstr. * Mention stripping whitespace in env name in the docs.
1 parent d70b4b7 commit 305d71a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

doc/config.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,11 @@ You can still list environments explicitly along with generated ones::
567567

568568
envlist = {py26,py27}-django{15,16}, docs, flake
569569

570+
Keep in mind that whitespace characters (except newline) within ``{}``
571+
are stripped, so the following line defines the same environment names::
572+
573+
envlist = {py26, py27}-django{ 15, 16 }, docs, flake
574+
570575
.. note::
571576

572577
To help with understanding how the variants will produce section values,

tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_config_parse_platform_with_factors(self, newconfig, plat, monkeypatch):
160160
monkeypatch.setattr(sys, "platform", "win32")
161161
config = newconfig([], """
162162
[tox]
163-
envlist = py27-{win,lin,osx}
163+
envlist = py27-{win, lin,osx }
164164
[testenv]
165165
platform =
166166
win: win32

tox/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def _expand_envstr(envstr):
895895

896896
def expand(env):
897897
tokens = re.split(r'\{([^}]+)\}', env)
898-
parts = [token.split(',') for token in tokens]
898+
parts = [re.sub('\s+', '', token).split(',') for token in tokens]
899899
return [''.join(variant) for variant in itertools.product(*parts)]
900900

901901
return mapcat(expand, envlist)

0 commit comments

Comments
 (0)