Empty "{posargs:foo}" gets replaced by "."

Issue #240 on hold
Daniel Hahler created an issue

Given the following tox.ini:

[tox]
skipsdist = true
[testenv]
commands = echo {posargs:foo}
whitelist_externals = echo

Just using tox outputs foo, but when trying to pass no positional arguments . (a single dot) get passed:

  % tox -- ""
  python runtests: PYTHONHASHSEED='456438988'
  python runtests: commands[0] | echo .
  .
  _____________________________________ summary ______________________________________
    python: commands succeeded
    congratulations :)

Comments (4)

  1. Daniel Hahler reporter

    This gets triggered by the args_are_paths setting, which defaults to true.

    The following patch fixes it:

    diff -r 6210dea5abf1 tox/_config.py
    --- a/tox/_config.py    Tue Apr 28 09:10:54 2015 +0200
    +++ b/tox/_config.py    Tue Apr 28 09:48:58 2015 +0200
    @@ -373,9 +373,10 @@
                 if vc.args_are_paths:
                     args = []
                     for arg in config.option.args:
    -                    origpath = config.invocationcwd.join(arg, abs=True)
    -                    if origpath.check():
    -                        arg = vc.changedir.bestrelpath(origpath)
    +                    if arg != '':
    +                        origpath = config.invocationcwd.join(arg, abs=True)
    +                        if origpath.check():
    +                            arg = vc.changedir.bestrelpath(origpath)
                         args.append(arg)
                 reader.addsubstitutions(args)
             setenv = {}
    
  2. Log in to comment