[testenv:sect1]
commands = something {posargs}
[testenv:sect2]
commands = {[testenv:sect1]commands}
$ Â tox -e sect2
File "/usr/bin/tox", line 9, in <module>
load_entry_point('tox==2.1.1', 'console_scripts', 'tox')()
File "/usr/lib/python3.5/site-packages/tox/session.py", line 38, in main
config = prepare(args)
File "/usr/lib/python3.5/site-packages/tox/session.py", line 26, in prepare
config = parseconfig(args)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 219, in parseconfig
parseini(config, inipath)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 669, in __init__
self.make_envconfig(name, section, reader._subs, config)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 697, in make_envconfig
res = meth(env_attr.name, env_attr.default)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 864, in getargvlist
return _ArgvlistReader.getargvlist(self, s)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 1013, in getargvlist
replaced = reader._replace(current_command)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 982, in _replace
return RE_ITEM_REF.sub(self._replace_match, x)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 978, in _replace_match
return handler(match)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 948, in _replace_substitution
val = self._substitute_from_other_section(sub_key)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 937, in _substitute_from_other_section
return self._replace(x)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 982, in _replace
return RE_ITEM_REF.sub(self._replace_match, x)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 978, in _replace_match
return handler(match)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 948, in _replace_substitution
val = self._substitute_from_other_section(sub_key)
File "/usr/lib/python3.5/site-packages/tox/config.py", line 942, in _substitute_from_other_section
"substitution key %r not found" % key)
tox.ConfigError: ConfigError: substitution key 'posargs' not found
Original comment by burkov-bostongene
Sorry, I 've a bug in this config: commands = ./runtests.py --nolint {posargs} is underindented. I fixed indentation and it works now.
Original comment by @nakato
2.3.0 was released before this patch.
There is currently not a release with this patch in it.
Original comment by burkov-bostongene
I've tried the following tox.ini with both tox 1.7.0 and tox 2.3.0 and both result in
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
config = prepare(args)
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
config = parseconfig(args)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 229, in parseconfig
parseini(config, inipath)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 729, in __init__
self.make_envconfig(name, section, reader._subs, config)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 764, in make_envconfig
res = reader.getlist(env_attr.name, sep="\n")
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 882, in getlist
s = self.getstring(name, None)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 949, in getstring
x = self._replace(x, name=name, crossonly=crossonly)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 973, in _replace
return Replacer(self, crossonly=crossonly).do_replace(value)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 992, in do_replace
return self.RE_ITEM_REF.sub(self._replace_match, x)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 1021, in _replace_match
return self._replace_substitution(match)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 1067, in _replace_substitution
val = self._substitute_from_other_section(sub_key)
File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 1061, in _substitute_from_other_section
"substitution key %r not found" % key)
tox.ConfigError: ConfigError: substitution key 'posargs' not found
tox.ini:
[tox]
envlist=dj{18,19,110}-py{27,35}-me{09,010}
[testenv]
deps =
-rrequirements_dev.txt
dj18: Django==1.8.*
dj19: Django==1.9.*
dj110: Django==1.10.*
djangorestframework==3.*
blinker==1.*
me09: mongoengine==0.9.*
me09: pymongo==2.*
me010: mongoengine==0.10.*
me010: pymongo==3.*
commands = ./runtests.py --nolint {posargs}
Original comment by @hpk42
fix issue279: allow cross-section substitution when the value contains
posargs. Thanks Sachi King for the PR.
→ <
Original comment by @nakato
Original comment by @mgedmin
Bug still present in tox 2.3.0.
Is there any chance of a 2.3.2 release to get this bug fix out so downstream packagers can update (xenial and yakkety both have 2.3.1) please?
we are already at 2.5 -- i am not bound myself to go for a 2.3.2, sorry. But if it's not too difficult to review i'll consider merging a PR which does a 2.3.2 into a separate branch on the repo.
As far as I can tell there's nothing to change from commit 9262476ae33ccba759ef4ea9c406e25b54797f06 to make a 2.3.2 release, and as such I can't propose a PR for that because there's no changes to propose :-)
are you saying that making a 2.3.2 release from that commit is all you need?
I uploaded a tox-2.3.2 to https://devpi.net/hpk/dev/ and am testing it ... let me know if releasing this to pypi would help you.
Yes, that is perfect, thanks Holger! Please do upload to pypi so downstream can be encouraged to package it.
To give a little more background on this:
ok, done and pushed to pypi, hope it helps. Btw, merlinux offers and is currently executing open source support contracts for devpi, tox, and pytest -- mail me for more info.
Most helpful comment
ok, done and pushed to pypi, hope it helps. Btw, merlinux offers and is currently executing open source support contracts for devpi, tox, and pytest -- mail me for more info.