Skip to content

Error while parsing tox.ini with {posargs: tests} after line continuation #437

@lopuhin

Description

@lopuhin

Here is an example tox.ini that triggers the error (edit: extra space after "posargs:" is important):

[tox]
envlist = py27

[testenv]
deps=
    pytest

commands=
    py.test --doctest-modules \
        {posargs: tests}

Running tox results in the following error:

$ tox
Traceback (most recent call last):
  File "toxvenv/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "toxvenv/lib/python3.5/site-packages/tox/session.py", line 38, in main
    config = prepare(args)
  File "toxvenv/lib/python3.5/site-packages/tox/session.py", line 26, in prepare
    config = parseconfig(args)
  File "toxvenv/lib/python3.5/site-packages/tox/config.py", line 239, in parseconfig
    parseini(config, inipath)
  File "toxvenv/lib/python3.5/site-packages/tox/config.py", line 760, in __init__
    self.make_envconfig(name, section, reader._subs, config)
  File "toxvenv/lib/python3.5/site-packages/tox/config.py", line 791, in make_envconfig
    res = meth(env_attr.name, env_attr.default)
  File "toxvenv/lib/python3.5/site-packages/tox/config.py", line 964, in getargvlist
    return _ArgvlistReader.getargvlist(self, s)
  File "toxvenv/lib/python3.5/site-packages/tox/config.py", line 1140, in getargvlist
    (reader.section_name, "commands"))
tox.ConfigError: ConfigError: line-continuation ends nowhere while resolving for [testenv:py27] commands

pip list output:

pip (9.0.1)
pluggy (0.4.0)
py (1.4.32)
setuptools (18.2)
tox (2.5.0)
virtualenv (15.1.0)

If line continuation is placed in a different place, for example:

commands=
    py.test \
        --doctest-modules {posargs: tests} 

everything is fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:documentationbug:minordoes not affect many people or has no big impactlevel:easyrought estimate that this might be quite easy to implementpr-merged

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions