summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald Evers <ronald@ch10.nl>2013-10-10 00:04:16 +0200
committerRonald Evers <ronald@ch10.nl>2013-10-10 00:04:16 +0200
commite6bbe271a0605515300188b606dd59a96fc9fd1b (patch)
tree603473b3b2d93be846dab1d7c48e1991324a9eac
parent032c292e3d0d913c469bf6d9f0a51b3abc38bf46 (diff)
downloadtox-e6bbe271a0605515300188b606dd59a96fc9fd1b.tar.gz
use substitution in install_command
-rw-r--r--tests/test_config.py9
-rw-r--r--tox/_config.py9
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index f029ed0..c6430d0 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -529,6 +529,15 @@ class TestConfigTestEnv:
install_command=pip install
""")
+ def test_install_command_substitutions(self, newconfig):
+ config = newconfig("""
+ [testenv]
+ install_command=some_install {toxinidir} {envname} {packages}
+ """)
+ envconfig = config.envconfigs['python']
+ assert envconfig.install_command == [
+ 'some_install', config.toxinidir, 'python', '{packages}']
+
def test_downloadcache(self, newconfig, monkeypatch):
monkeypatch.delenv("PIP_DOWNLOAD_CACHE", raising=False)
config = newconfig("""
diff --git a/tox/_config.py b/tox/_config.py
index 3836f02..b9714a2 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -341,7 +341,7 @@ class parseini:
section,
"install_command",
"pip install " + " ".join(pip_default_opts),
- replace=False,
+ replace=True,
)
if '{packages}' not in vc.install_command:
raise tox.exception.ConfigError(
@@ -597,6 +597,13 @@ class IniReader:
if self._is_bare_posargs(g):
return self._do_replace_posargs(lambda: '')
+ # special case: opts and packages. Leave {opts} and
+ # {packages} intact, they are replaced manually in
+ # _venv.VirtualEnv.run_install_command.
+ sub_value = g['substitution_value']
+ if sub_value in ('opts', 'packages'):
+ return '{%s}' % sub_value
+
handlers = {
'posargs' : self._replace_posargs,
'env' : self._replace_env,