Generative setenv fails if there’s only one variable

Issue #190 on hold
Hynek Schlawack created an issue

Consider this minimal tox.ini:

[tox]
envlist = py27-{a,b}

[testenv]
deps =
    b: pytest
setenv =
    a: A = 1
commands = true

Running tox -l on it fails with

Traceback (most recent call last):
  File "/Users/hynek/.local/bin/tox", line 9, in <module>
    load_entry_point('tox==1.8.0', 'console_scripts', 'tox')()
  File "/Users/hynek/.local/venvs/tox/lib/python2.7/site-packages/tox/_cmdline.py", line 25, in main
    config = parseconfig(args, 'tox')
  File "/Users/hynek/.local/venvs/tox/lib/python2.7/site-packages/tox/_config.py", line 42, in parseconfig
    parseini(config, inipath)
  File "/Users/hynek/.local/venvs/tox/lib/python2.7/site-packages/tox/_config.py", line 296, in __init__
    self._makeenvconfig(name, section, reader._subs, config)
  File "/Users/hynek/.local/venvs/tox/lib/python2.7/site-packages/tox/_config.py", line 354, in _makeenvconfig
    setenv.update(reader.getdict(section, 'setenv'))
  File "/Users/hynek/.local/venvs/tox/lib/python2.7/site-packages/tox/_config.py", line 529, in getdict
    name, rest = line.split('=', 1)
ValueError: need more than 1 value to unpack

while

[tox]
envlist = py27-{a,b}

[testenv]
setenv =
    a: A = 1
    b: B = 1
commands = true

and

[tox]
envlist = py27

[testenv]
setenv =
    A = 1
commands = true

work just fine.

Comments (4)

  1. Holger Krekel repo owner

    Even just this fails:

    [testenv]
    setenv =
    commands = true
    

    But with conditional settings we land in this situation easier. Originally conditional syntax was only targetted at deps but it seems there is a need for other config options as well. cc @suor

  2. Log in to comment