Commits

Ronald Evers committed bb2943b

use substitution in install_command

Comments (0)

Files changed (2)

tests/test_config.py

             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("""
             section,
             "install_command",
             "pip install " + " ".join(pip_default_opts),
-            replace=False,
+            replace=True,
             )
         if '{packages}' not in vc.install_command:
             raise tox.exception.ConfigError(
         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,