posargs should be able to do substitutions

Issue #196 on hold
Andy Hayden created an issue

Similar to #150.

The http://tox.readthedocs.org/en/latest/config.html#substitutions-for-positional-arguments-in-commands suggests that the following should work but it results in a ConfigError:

echo {posargs:{env:USER:} passed no posargs}

Comments (6)

  1. Holger Krekel repo owner

    It actually works for me although i think it's a bit unspecified if it should work :) could you provide a full tox.ini file, output of "tox --version" and the failing tox run with traceback?

  2. Andy Hayden reporter

    This is 1.8.0, hmm now I look back at this I see it just says posargs is not supported, and I can remove everything to {posargs:nothing} and it still fails.

    I was sure this had been different/more specific when I noticed this earlier...

    Traceback (most recent call last):
      File "/Users/andy/anaconda/bin/tox", line 9, in <module>
        load_entry_point('tox==1.8.0', 'console_scripts', 'tox')()
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_cmdline.py", line 25, in main
        config = parseconfig(args, 'tox')
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 42, in parseconfig
        parseini(config, inipath)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 296, in __init__
        self._makeenvconfig(name, section, reader._subs, config)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 359, in _makeenvconfig
        vc.commands = reader.getargvlist(section, "commands")
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 552, in getargvlist
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 581, in _processcommand
        new_word = self._replace(word)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 730, in _replace
        return RE_ITEM_REF.sub(self._replace_match, x)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 726, in _replace_match
        return handler(match)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 697, in _replace_substitution
        val = self._substitute_from_other_section(sub_key)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 686, in _substitute_from_other_section
        return self._replace(x)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 730, in _replace
        return RE_ITEM_REF.sub(self._replace_match, x)
      File "/Users/andy/anaconda/lib/python2.7/site-packages/tox/_config.py", line 724, in _replace_match
        raise tox.exception.ConfigError("No support for the %s substitution type" % sub_type)
    tox.ConfigError: ConfigError: No support for the posargs substitution type

    tox.ini was here https://github.com/hayd/ctox/blob/master/tox.ini. Note there's also another issue in that config with spacing around substitutions e.g. { envpython }. (I had been reimplementing tox parsing from the spec without looking at what you actually did so hadn't realised that wasn't valid).

  3. Holger Krekel repo owner

    there are a couple of syntactical issues with this tox.ini, here is a variant that works. I guess the error messages could be better.

        {envbindir}/python --version
        python -c "import os; print(os.getcwd())"
        # comment lines are ignored
        echo {env:USER:}
        echo {posargs:{env:USER:} passed no posargs}
        {envpython} -c "import sys; print(sys.version_info)"
        {envpython} -c "import ctox" 
    changedir = {toxinidir}
        py{33,34}: docformatter
        py27: unify
        unify: unify
  4. Log in to comment