diff options
| author | holger krekel <holger@merlinux.eu> | 2015-11-11 15:58:33 +0100 |
|---|---|---|
| committer | holger krekel <holger@merlinux.eu> | 2015-11-11 15:58:33 +0100 |
| commit | a925190c8cc9600411b0e7c0e76a03a0ee40b1b3 (patch) | |
| tree | 213f0d8261c398d8ab53e089ff6595318d01c6a0 | |
| parent | 4ea2f08501c99bca26e5d4b42b7a85c1a3eb2a98 (diff) | |
| download | tox-git-2.2.1.tar.gz | |
fix setenv/substitution bug2.2.1
| -rw-r--r-- | CHANGELOG | 6 | ||||
| -rw-r--r-- | setup.py | 2 | ||||
| -rw-r--r-- | tests/test_config.py | 26 | ||||
| -rw-r--r-- | tox/__init__.py | 2 | ||||
| -rw-r--r-- | tox/config.py | 10 |
5 files changed, 39 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2.2.1 +----- + +- fix bug where {envdir} substitution could not be used in setenv + if that env value is then used in {basepython}. Thanks Florian Bruhin. + 2.2.0 ----- @@ -48,7 +48,7 @@ def main(): description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.2.0', + version='2.2.1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff --git a/tests/test_config.py b/tests/test_config.py index 16e1e573..61047c1f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -738,6 +738,32 @@ class TestConfigTestEnv: assert envconfig.setenv['PYTHONPATH'] == 'something' assert envconfig.setenv['ANOTHER_VAL'] == 'else' + def test_setenv_with_envdir_and_basepython(self, tmpdir, newconfig): + config = newconfig(""" + [testenv] + setenv = + VAL = {envdir} + basepython = {env:VAL} + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['python'] + assert 'VAL' in envconfig.setenv + assert envconfig.setenv['VAL'] == envconfig.envdir + assert envconfig.basepython == envconfig.envdir + + def test_setenv_ordering_1(self, tmpdir, newconfig): + config = newconfig(""" + [testenv] + setenv= + VAL={envdir} + commands=echo {env:VAL} + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['python'] + assert 'VAL' in envconfig.setenv + assert envconfig.setenv['VAL'] == envconfig.envdir + assert str(envconfig.envdir) in envconfig.commands[0] + @pytest.mark.parametrize("plat", ["win32", "linux2"]) def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, plat): monkeypatch.setattr(sys, "platform", plat) diff --git a/tox/__init__.py b/tox/__init__.py index d623f38e..c1e74fb5 100644 --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.2.0' +__version__ = '2.2.1' from .hookspecs import hookspec, hookimpl # noqa diff --git a/tox/config.py b/tox/config.py index 76761270..9f5aae38 100644 --- a/tox/config.py +++ b/tox/config.py @@ -324,6 +324,10 @@ def tox_addoption(parser): help="additional arguments available to command positional substitution") # add various core venv interpreter attributes + parser.add_testenv_attribute( + name="envdir", type="path", default="{toxworkdir}/{envname}", + help="venv directory") + def basepython_default(testenv_config, value): if value is None: for f in testenv_config.factors: @@ -338,10 +342,6 @@ def tox_addoption(parser): "virtual test environment.") parser.add_testenv_attribute( - name="envdir", type="path", default="{toxworkdir}/{envname}", - help="venv directory") - - parser.add_testenv_attribute( name="envtmpdir", type="path", default="{envdir}/tmp", help="venv temporary directory") @@ -716,7 +716,7 @@ class parseini: if atype == "path": reader.addsubstitutions(**{env_attr.name: res}) - if env_attr.name == "envdir": + if env_attr.name == "basepython": reader.addsubstitutions(envbindir=vc.envbindir, envpython=vc.envpython, envsitepackagesdir=vc.envsitepackagesdir) return vc |
