diff options
| author | holger krekel <holger@merlinux.eu> | 2013-02-12 11:36:52 +0100 |
|---|---|---|
| committer | holger krekel <holger@merlinux.eu> | 2013-02-12 11:36:52 +0100 |
| commit | d9146bdc36aebd41eb06a2fadd6db65c2831df62 (patch) | |
| tree | b3d101421734269d186f79f61df23c3e79ae1b99 | |
| parent | ff9d930e555709a6249b4bf2b4c4b4416db79886 (diff) | |
| download | tox-d9146bdc36aebd41eb06a2fadd6db65c2831df62.tar.gz | |
fix downloadcache determination to work according to docs: Only
make pip use a download cache if PIP_DOWNLOAD_CACHE or a
downloadcache=PATH testenv setting is present. (The ENV setting
takes precedence)
| -rwxr-xr-x | CHANGELOG | 5 | ||||
| -rw-r--r-- | doc/config.txt | 5 | ||||
| -rw-r--r-- | setup.py | 2 | ||||
| -rw-r--r-- | tests/test_venv.py | 18 | ||||
| -rw-r--r-- | tox/__init__.py | 2 | ||||
| -rw-r--r-- | tox/_config.py | 12 | ||||
| -rw-r--r-- | tox/_pytestplugin.py | 2 | ||||
| -rw-r--r-- | toxbootstrap.py | 2 |
8 files changed, 31 insertions, 17 deletions
@@ -1,6 +1,11 @@ 1.4.3.dev ----------------- +- fix downloadcache determination to work according to docs: Only + make pip use a download cache if PIP_DOWNLOAD_CACHE or a + downloadcache=PATH testenv setting is present. (The ENV setting + takes precedence) + - experimentally introduce --installpkg=PATH option to install a package rather than create/install an sdist package. This will still require and use tox.ini and tests from the current working dir (and not from the remote diff --git a/doc/config.txt b/doc/config.txt index 8829d1b..b4a3c58 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -106,8 +106,9 @@ Complete list of settings that you can put into ``testenv*`` sections: .. confval:: downloadcache=path - (pip only) use this directory for caching downloads - this defaults to the - environment variable ``PIP_DOWNLOAD_CACHE`` if it is set. + (pip only) use this directory for caching downloads. This value + is overriden by the environment variable ``PIP_DOWNLOAD_CACHE`` + if it exists. **default**: no download cache will be used. **note**: if creating multiple environments use of a download cache greatly speeds up the testing process. @@ -49,7 +49,7 @@ def main(): description='virtualenv-based automation of test activities', long_description=long_description, url='http://tox.testrun.org/', - version='1.4.3.dev5', + version='1.4.3.dev6', license='GPLv2 or later', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff --git a/tests/test_venv.py b/tests/test_venv.py index 7984b00..099247a 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -25,6 +25,7 @@ def test_locate_via_py(monkeypatch): assert args[1] == '-c' # Return value needs to actually exist! return sys.executable + @staticmethod def ret_pseudopy(name): assert name == 'py' return PseudoPy() @@ -162,13 +163,18 @@ def test_install_deps_wildcard(newmocksession): assert l[1].cwd == venv.envconfig.envlogdir assert "pip" in str(args[0]) assert args[1] == "install" - arg = "--download-cache=" + str(venv.envconfig.downloadcache) - assert arg in args[2:] + #arg = "--download-cache=" + str(venv.envconfig.downloadcache) + #assert arg in args[2:] args = [arg for arg in args if str(arg).endswith("dep1-1.1.zip")] assert len(args) == 1 -def test_install_downloadcache(newmocksession): +@pytest.mark.parametrize("envdc", [True, False]) +def test_install_downloadcache(newmocksession, monkeypatch, tmpdir, envdc): + if envdc: + monkeypatch.setenv("PIP_DOWNLOAD_CACHE", tmpdir) + else: + monkeypatch.delenv("PIP_DOWNLOAD_CACHE", raising=False) mocksession = newmocksession([], """ [testenv:py123] distribute=True @@ -187,8 +193,10 @@ def test_install_downloadcache(newmocksession): assert l[1].cwd == venv.envconfig.envlogdir assert "pip" in str(args[0]) assert args[1] == "install" - arg = "--download-cache=" + str(venv.envconfig.downloadcache) - assert arg in args[2:] + if envdc: + assert venv.envconfig.downloadcache == tmpdir + else: + assert not venv.envconfig.downloadcache assert "dep1" in args assert "dep2" in args deps = list(filter(None, [x[1] for x in venv._getliveconfig().deps])) diff --git a/tox/__init__.py b/tox/__init__.py index b57d4d6..7c24641 100644 --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '1.4.3.dev5' +__version__ = '1.4.3.dev6' class exception: class Error(Exception): diff --git a/tox/_config.py b/tox/_config.py index 171e20b..cf09e85 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -298,12 +298,12 @@ class parseini: vc.deps.append(DepConfig(name, ixserver)) vc.distribute = reader.getbool(section, "distribute", True) vc.sitepackages = reader.getbool(section, "sitepackages", False) - downloadcache = reader.getdefault(section, "downloadcache") - if downloadcache is None: - downloadcache = os.environ.get("PIP_DOWNLOAD_CACHE", "") - if not downloadcache: - downloadcache = self.config.toxworkdir.join("_download") - vc.downloadcache = py.path.local(downloadcache) + vc.downloadcache = None + downloadcache = os.environ.get("PIP_DOWNLOAD_CACHE", None) + if not downloadcache: + downloadcache = reader.getdefault(section, "downloadcache") + if downloadcache: + vc.downloadcache = py.path.local(downloadcache) return vc def _getenvlist(self, reader, toxsection): diff --git a/tox/_pytestplugin.py b/tox/_pytestplugin.py index 70fa48a..b32d454 100644 --- a/tox/_pytestplugin.py +++ b/tox/_pytestplugin.py @@ -269,7 +269,7 @@ def initproj(request, tmpdir): ''' % locals()}) if name not in filedefs: create_files(base, {name: - {'__init__.py': '__version__ = %s' % version}}) + {'__init__.py': '__version__ = %r' % version}}) manifestlines = [] for p in base.visit(lambda x: x.check(file=1)): manifestlines.append("include %s" % p.relto(base)) diff --git a/toxbootstrap.py b/toxbootstrap.py index c3fea7d..614817a 100644 --- a/toxbootstrap.py +++ b/toxbootstrap.py @@ -58,7 +58,7 @@ ToDo """ -__version__ = '1.4.3.dev5' +__version__ = '1.4.3.dev6' import sys import os |
