From 62f51be1a1b15ea71ac4359242b612e665289ca0 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 4 Sep 2013 15:37:24 +0200 Subject: fix issue102: change to {toxinidir} when installing packages and dependencies. this allows to use relative path like in "-rrequirements.txt". --- CHANGELOG | 3 +++ doc/conf.py | 2 +- doc/config.txt | 5 ++++- doc/example/basic.txt | 17 ++++++++++++++++- doc/example/devenv.txt | 4 +--- tests/test_venv.py | 4 ++-- tox/_venv.py | 6 +++--- 7 files changed, 30 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 844b457..07d80dc 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,9 @@ want to support python2.5/pip1.3.1 based test environments you need to install ssl and/or use PIP_INSECURE=1 through ``setenv``. section. +- fix issue102: change to {toxinidir} when installing dependencies. + this allows to use relative path like in "-rrequirements.txt". + 1.6.0 ----------------- diff --git a/doc/conf.py b/doc/conf.py index be0411a..d2f74ed 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -48,7 +48,7 @@ copyright = u'2013, holger krekel and others' # built documents. # # The short X.Y version. -release = version = "1.6.0" +release = version = "1.6.1" # The full version, including alpha/beta/rc tags. # The language for content autogenerated by Sphinx. Refer to documentation diff --git a/doc/config.txt b/doc/config.txt index db33373..d147535 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -124,7 +124,7 @@ Complete list of settings that you can put into ``testenv*`` sections: test-specific dependencies -.to be installed into the environment prior to project package installation. Each line defines a dependency, which will be - passed to easy_install/pip for processing. A line specify a file, + passed to the installer command for processing. A line specify a file, an URL or a package name. You can additionally specify an :confval:`indexserver` to use for installing this dependency. All derived dependencies (deps required by the dep) will then be @@ -132,6 +132,9 @@ Complete list of settings that you can put into ``testenv*`` sections: deps = :myindexserver:pkg + (Experimentally introduced in 1.6.1) all installer commands are executed + using the ``{toxinidir}`` as the current working directory. + .. confval:: setenv=MULTI-LINE-LIST .. versionadded:: 0.9 diff --git a/doc/example/basic.txt b/doc/example/basic.txt index 612146d..55b0848 100644 --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -44,7 +44,7 @@ Available "default" test environments names are:: However, you can also create your own test environment names, see some of the examples in :doc:`examples <../examples>`. -whitelisting a non-virtualenv commands +whitelisting non-virtualenv commands ----------------------------------------------- .. versionadded:: 1.5 @@ -64,6 +64,21 @@ configuration:: .. _multiindex: +depending on requirements.txt +----------------------------------------------- + +.. versionadded:: 1.6.1 + +(experimental) If you have a ``requirements.txt`` file +you can add it to your ``deps`` variable like this:: + + deps = -rrequirements.txt + +All installation commands are executed using ``{toxinidir}}`` +(the directory where ``tox.ini`` resides) as the current +working directory. Therefore, the underlying ``pip`` installation +will assume ``requirements.txt`` to exist at ``{toxinidir}/requirements.txt``. + using a different default PyPI url ----------------------------------------------- diff --git a/doc/example/devenv.txt b/doc/example/devenv.txt index 8e3f854..571f89c 100644 --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -57,7 +57,5 @@ Here is example configuration for that:: envdir = devenv basepython = python2.7 usedevelop = True - deps = - commands = - pip install -r requirements.txt + deps = -rrequirements.txt diff --git a/tests/test_venv.py b/tests/test_venv.py index ab34db7..67bdb92 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -133,7 +133,7 @@ def test_install_deps_wildcard(newmocksession): venv.install_deps() assert len(l) == 2 + py25calls args = l[-1].args - assert l[-1].cwd == venv.envconfig.envlogdir + assert l[-1].cwd == venv.envconfig.config.toxinidir assert "pip" in str(args[0]) assert args[1] == "install" #arg = "--download-cache=" + str(venv.envconfig.downloadcache) @@ -163,7 +163,7 @@ def test_install_downloadcache(newmocksession, monkeypatch, tmpdir, envdc): venv.install_deps() assert len(l) == 2 + py25calls args = l[-1].args - assert l[-1].cwd == venv.envconfig.envlogdir + assert l[-1].cwd == venv.envconfig.config.toxinidir assert "pip" in str(args[0]) assert args[1] == "install" assert "dep1" in args diff --git a/tox/_venv.py b/tox/_venv.py index d67ddb9..ec7ada2 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -216,7 +216,7 @@ class VirtualEnv(object): action.setactivity('pip-downgrade', 'pip<1.4') argv = ["easy_install"] + \ self._installopts(indexserver) + ['pip<1.4'] - self._pcall(argv, cwd=self.envconfig.envlogdir, + self._pcall(argv, cwd=self.envconfig.config.toxinidir, action=action) def finish(self): @@ -299,8 +299,8 @@ class VirtualEnv(object): env = dict(PYTHONIOENCODING='utf_8') if extraenv is not None: env.update(extraenv) - self._pcall(argv, cwd=self.envconfig.envlogdir, - extraenv=env, action=action) + self._pcall(argv, cwd=self.envconfig.config.toxinidir, + extraenv=env, action=action) def _install(self, deps, extraopts=None, action=None): if not deps: -- cgit v1.2.1