2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/413cd4cd876a/ changeset: 413cd4cd876a user: hpk42 date: 2013-02-12 11:35:57 summary: refining multi-dimensional tox support affected #: 1 file
diff -r 33d2d5195d8234db4c1d2e801e1f443611edd576 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 doc/config-v2.txt --- a/doc/config-v2.txt +++ b/doc/config-v2.txt @@ -55,14 +55,14 @@ with testenvs - allow platform-specific settings - allow to specify platforms against which tests should run -- allow to run installer-variants (easy_install or pip) +- allow to run installer-variants (easy_install or pip, xxx) - try to mimick/re-use bash-style syntax to ease learning curve. Example: Generating and selecting variants ---------------------------------------------- -Suppose you want to test your package python2.6, python2.7 and on the +Suppose you want to test your package against python2.6, python2.7 and on the windows and linux platforms. Today you would have to write down 2*2 = 4 ``[testenv:*]`` sections and then instruct tox to run a specific list of environments on each platform. @@ -71,7 +71,7 @@ # combination syntax gives 2 * 2 = 4 testenv names # - envlist = {py26,py27}-{win,linux}, {py31,py32}-linux + envlist = {py26,py27}-{win,linux} [testenv] deps = pytest @@ -101,12 +101,6 @@ windows: windows linux: linux -With - -ConcretelyThe next configuration item defines the platform, depending on the -environment name for which the ``[testenv]`` is used:: - - These two conditional settings will lead to either ``windows`` or ``linux`` as the platform string. When the test environment is run, its platform string needs to be contained in the string returned @@ -143,18 +137,6 @@ Voila, this multi-dimensional ``tox.ini`` configuration defines 2*2=4 environments. -Adding mypkg13,mypkg14 dependency variants --------------------------------------------- - -XXX -This defines an unconditional dependency ``pytest`` which is going to be -installed in all environments. It also defines two conditional dependencies: - -- if ``mypkg13`` is part of the environment name, the ``mypkg<1.4`` spec - will be used, otherwise the line is empty. -- if ``mypkg14`` is part of the environment name, the ``mypkg>=1.4,<1.5`` spec - will be used, otherwise the line is empty. - The new "platform" setting -------------------------------------- @@ -179,18 +161,7 @@ Parts of an environment name are obtained by ``-``-splitting it. Variant specification with [variant:VARNAME] ----------------------------------------------- -Apart from using conditional settings, you can also write down -a ``[variant::VARIANTNAME]`` section, allowing to define settings -for the respective variant. Variant settings will be merged from -left to right so an environment name ``abc-def`` will lookup -and merge settings from ``abc``, then from ``def``. - -.. - Note that a direct ``[variant:xyz-abc]`` testenv definition - can override any automatically produced settings. - Showing all expanded sections ------------------------------- @@ -253,30 +224,27 @@ envlist = {py25,py26,py27}-{django12,django13}{,-example} [testenv] - commands = python setup.py test deps= coverage==3.4 unittest-xml-reporting==1.2 Pyyaml==3.10 django12: django==1.2.4 django13: django==1.3.1 + # some more deps for running examples + example: wsgiref==0.1.2 + example: Pygments==1.4 + example: httplib2==0.6.0 + example: Markdown==2.0.3 + + commands = + !example: python setup.py test + example: python examples/runtests.py + - [envpart:example] - commands = python examples/runtests.py - +deps = - wsgiref==0.1.2 - Pygments==1.4 - httplib2==0.6.0 - Markdown==2.0.3 - -Note that ``{,-example}`` in the envlist denotes an empty env and the -"example" envpart. The empty envpart means that there are no specific +Note that ``{,-example}`` in the envlist denotes two values, an empty +one and a ``example`` one. The empty value means that there are no specific settings and thus no need to define a variant name. -Note also that ``+deps`` means that we are appending to dependencies, -not substituting them. - - Transforming the examples: django-treebeard ------------------------------------------------ @@ -289,10 +257,9 @@ we also produce 36 specific testenvs with specific dependencies and test commands:: - [tox] - envlist = - [py24,py25,py26,py27]-[django11,django12,django13]-[nodb,pg,mysql] - docs + [tox] + envlist = + {py24,py25,py26,py27}-{django11,django12,django13}-{nodb,pg,mysql}, docs [testenv:docs] changedir = docs @@ -323,8 +290,3 @@ mysql: {envpython} runtests.py --DATABASE_ENGINE=mysql \ --DATABASE_USER=root {posargs} -It's noteworthy here that you can also use conditionals in the commands. - - - - https://bitbucket.org/hpk42/tox/commits/a77eb52145e2/ changeset: a77eb52145e2 user: hpk42 date: 2013-02-12 11:36:52 summary: 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) affected #: 8 files diff -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -106,8 +106,9 @@ .. 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. diff -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 setup.py --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ 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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -25,6 +25,7 @@ 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 @@ 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 @@ 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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 tox/__init__.py --- 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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -298,12 +298,12 @@ 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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 tox/_pytestplugin.py --- a/tox/_pytestplugin.py +++ b/tox/_pytestplugin.py @@ -269,7 +269,7 @@ ''' % 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 -r 413cd4cd876a739a2901d259aa8e38b0ba8f59c6 -r a77eb52145e259314a341222866c3e6806024a15 toxbootstrap.py --- a/toxbootstrap.py +++ b/toxbootstrap.py @@ -58,7 +58,7 @@ """ -__version__ = '1.4.3.dev5' +__version__ = '1.4.3.dev6' import sys import os Repository URL: https://bitbucket.org/hpk42/tox/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit