summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2015-11-11 15:58:33 +0100
committerholger krekel <holger@merlinux.eu>2015-11-11 15:58:33 +0100
commit715a217fb928a54070192a653fa585948b619d13 (patch)
tree9e61d9bce1f23f41e7464c565b30f55efa640aab
parent86065b7d59bfabc00eeec3cd50d31885c5cadfe6 (diff)
downloadtox-715a217fb928a54070192a653fa585948b619d13.tar.gz
fix setenv/substitution bug2.2.1
-rw-r--r--CHANGELOG6
-rw-r--r--setup.py2
-rw-r--r--tests/test_config.py26
-rw-r--r--tox/__init__.py2
-rw-r--r--tox/config.py10
5 files changed, 39 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e27a42a..11ecb1f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
-----
diff --git a/setup.py b/setup.py
index 71fdcdc..a398ade 100644
--- a/setup.py
+++ b/setup.py
@@ -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 16e1e57..61047c1 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 d623f38..c1e74fb 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 7676127..9f5aae3 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