5 new commits in tox: https://bitbucket.org/hpk42/tox/commits/92d5e08065fc/ Changeset: 92d5e08065fc User: hpk42 Date: 2015-04-20 18:40:23+00:00 Summary: remove empty vendor directory Affected #: 2 files
diff -r 45733e7d58f2617938fd2e9dd0c64860785b3974 -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 setup.py --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', author_email='hol...@merlinux.eu', - packages=['tox', 'tox.vendor'], + packages=['tox'], entry_points={'console_scripts': 'tox=tox:cmdline\ntox-quickstart=tox._quickstart:main'}, # we use a public tox version to test, see tox.ini's testenv # "deps" definition for the required dependencies diff -r 45733e7d58f2617938fd2e9dd0c64860785b3974 -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 tox/vendor/__init__.py --- a/tox/vendor/__init__.py +++ /dev/null @@ -1,1 +0,0 @@ -# https://bitbucket.org/hpk42/tox/commits/1877e74ab9b8/ Changeset: 1877e74ab9b8 User: hpk42 Date: 2015-04-20 19:51:46+00:00 Summary: introduce new "platform" setting for tox (XXX) consider using environment marker syntax Affected #: 9 files diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,11 @@ -dev +2.0.dev1 ----------- -- +- introduce a way to specify on which platform a testenvironment is to + execute: the new per-environment "platform" setting allows to specify + a regular expression which is matched against sys.platform. + If platform is set and doesn't match the test environment the + test environment is ignored, no setup or tests are attempted. 1.9.2 diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -155,6 +155,12 @@ (Experimentally introduced in 1.6.1) all installer commands are executed using the ``{toxinidir}`` as the current working directory. +.. confval:: platform=REGEX + + A testenv can define a new ``platform`` setting as a regular expression. + If a non-empty expression is defined and does not match against the + ``sys.platform`` string the test environment will be skipped. + .. confval:: setenv=MULTI-LINE-LIST .. versionadded:: 0.9 diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -46,6 +46,19 @@ However, you can also create your own test environment names, see some of the examples in :doc:`examples <../examples>`. +specifying a platform +----------------------------------------------- + +.. versionadded:: 2.0 + +If you want to specify which platform(s) your test environment +runs on you can set a platform regular expression like this:: + + platform = linux2|darwin + +If the expression does not match against ``sys.platform`` +the test environment will be skipped. + whitelisting non-virtualenv commands ----------------------------------------------- diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -7,6 +7,7 @@ import tox._config from tox._config import * # noqa from tox._config import _split_env +from tox._venv import VirtualEnv class TestVenvConfig: @@ -18,6 +19,7 @@ assert config.toxworkdir.realpath() == tmpdir.join(".tox").realpath() assert config.envconfigs['py1'].basepython == sys.executable assert config.envconfigs['py1'].deps == [] + assert not config.envconfigs['py1'].platform def test_config_parsing_multienv(self, tmpdir, newconfig): config = newconfig([], """ @@ -98,6 +100,50 @@ assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<=2.0') assert not parseini._is_same_dep('pkg_hello-world3==1.0', 'otherpkg>=2.0') + +class TestConfigPlatform: + def test_config_parse_platform(self, newconfig): + config = newconfig([], """ + [testenv:py1] + platform = linux2 + """) + assert len(config.envconfigs) == 1 + assert config.envconfigs['py1'].platform == "linux2" + + def test_config_parse_platform_rex(self, newconfig, mocksession, monkeypatch): + config = newconfig([], """ + [testenv:py1] + platform = a123|b123 + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['py1'] + venv = VirtualEnv(envconfig, session=mocksession) + assert not venv.matching_platform() + monkeypatch.setattr(sys, "platform", "a123") + assert venv.matching_platform() + monkeypatch.setattr(sys, "platform", "b123") + assert venv.matching_platform() + monkeypatch.undo() + assert not venv.matching_platform() + + + @pytest.mark.parametrize("plat", ["win", "lin", ]) + def test_config_parse_platform_with_factors(self, newconfig, plat, monkeypatch): + monkeypatch.setattr(sys, "platform", "win32") + config = newconfig([], """ + [tox] + envlist = py27-{win,lin,osx} + [testenv] + platform = + win: win32 + lin: linux2 + """) + assert len(config.envconfigs) == 3 + platform = config.envconfigs['py27-' + plat].platform + expected = {"win": "win32", "lin": "linux2"}.get(plat) + assert platform == expected + + class TestConfigPackage: def test_defaults(self, tmpdir, newconfig): config = newconfig([], "") diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -242,6 +242,24 @@ "*ERROR*InterpreterNotFound*xyz_unknown_interpreter*", ]) +def test_skip_platform_mismatch(cmd, initproj): + initproj("interp123-0.5", filedefs={ + 'tests': {'test_hello.py': "def test_hello(): pass"}, + 'tox.ini': ''' + [testenv] + changedir=tests + platform=x123 + ''' + }) + result = cmd.run("tox") + assert not result.ret + assert "platform mismatch" not in result.stdout.str() + result = cmd.run("tox", "-v") + assert not result.ret + result.stdout.fnmatch_lines([ + "*python*platform mismatch*" + ]) + def test_skip_unknown_interpreter(cmd, initproj): initproj("interp123-0.5", filedefs={ 'tests': {'test_hello.py': "def test_hello(): pass"}, diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -474,6 +474,9 @@ if self.config.option.sdistonly: return for venv in self.venvlist: + if not venv.matching_platform(): + venv.status = "platform mismatch" + continue # we simply omit non-matching platforms if self.setupenv(venv): if venv.envconfig.develop: self.developpkg(venv, self.config.setupdir) @@ -505,6 +508,9 @@ else: retcode = 1 self.report.error(msg) + elif status == "platform mismatch": + msg = " %s: %s" %(venv.envconfig.envname, str(status)) + self.report.verbosity1(msg) elif status and status != "skipped tests": msg = " %s: %s" %(venv.envconfig.envname, str(status)) self.report.error(msg) diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -151,9 +151,11 @@ homedir = self.toxinidir # XXX good idea? return homedir + class VenvConfig: - def __init__(self, **kw): - self.__dict__.update(kw) + def __init__(self, envname, config): + self.envname = envname + self.config = config @property def envbindir(self): @@ -195,6 +197,8 @@ "python2.5 is not supported anymore, sorry") return info.executable + + testenvprefix = "testenv:" def get_homedir(): @@ -321,8 +325,7 @@ return factors def _makeenvconfig(self, name, section, subs, config): - vc = VenvConfig(envname=name) - vc.config = config + vc = VenvConfig(config=config, envname=name) factors = set(name.split('-')) reader = IniReader(self._cfg, fallbacksections=["testenv"], factors=factors) @@ -381,6 +384,13 @@ ixserver = None name = self._replace_forced_dep(name, config) vc.deps.append(DepConfig(name, ixserver)) + + platform = "" + for platform in reader.getlist(section, "platform"): + if platform.strip(): + break + vc.platform = platform + vc.distribute = reader.getbool(section, "distribute", False) vc.sitepackages = self.config.option.sitepackages or \ reader.getbool(section, "sitepackages", False) diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -1,5 +1,6 @@ from __future__ import with_statement import sys, os +import re import codecs import py import tox @@ -171,6 +172,9 @@ def getsupportedinterpreter(self): return self.envconfig.getsupportedinterpreter() + def matching_platform(self): + return re.match(self.envconfig.platform, sys.platform) + def create(self, action=None): #if self.getcommandpath("activate").dirpath().check(): # return diff -r 92d5e08065fc927d14ecb7e4c8081a219bce9cf5 -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 tox/interpreters.py --- a/tox/interpreters.py +++ b/tox/interpreters.py @@ -90,11 +90,12 @@ class InterpreterInfo: runnable = True - def __init__(self, name, executable, version_info): + def __init__(self, name, executable, version_info, sysplatform): assert executable and version_info self.name = name self.executable = executable self.version_info = version_info + self.sysplatform = sysplatform def __str__(self): return "<executable at %s, version_info %s>" % ( @@ -163,7 +164,8 @@ def pyinfo(): import sys - return dict(version_info=tuple(sys.version_info)) + return dict(version_info=tuple(sys.version_info), + sysplatform=sys.platform) def sitepackagesdir(envdir): from distutils.sysconfig import get_python_lib https://bitbucket.org/hpk42/tox/commits/49f0a9981117/ Changeset: 49f0a9981117 User: hpk42 Date: 2015-04-21 09:51:10+00:00 Summary: trying out isolating env variables Affected #: 10 files diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,21 @@ -2.0.dev1 +2.0.0.dev1 ----------- -- introduce a way to specify on which platform a testenvironment is to - execute: the new per-environment "platform" setting allows to specify +- (new) introduce environment variable isolation: + tox now only passes the PATH variable from the tox + invocation environment to the test environment and on Windows + also ``SYSTEMROOT`` and ``PATHEXT``. If you need to pass through further + environment variables you can use the new ``passenv`` setting, + a space-separated list of environment variable names. Each name + can make use of fnmatch-style glob patterns. All environment + variables which exist in the tox-invocation environment will be copied + to the test environment. + +- (new) introduce a way to specify on which platform a testenvironment is to + execute: the new per-venv "platform" setting allows to specify a regular expression which is matched against sys.platform. - If platform is set and doesn't match the test environment the - test environment is ignored, no setup or tests are attempted. + If platform is set and doesn't match the platform spec in the test + environment the test environment is ignored, no setup or tests are attempted. 1.9.2 diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -169,6 +169,20 @@ will be used for all test command invocations as well as for installing the sdist package into a virtual environment. +.. confval:: passenv=SPACE-SEPARATED-GLOBNAMES + + .. versionadded:: 2.0 + + A list of wildcard environment variable names which + shall be copied from the tox invocation environment to the test + environment. If a specified environment variable doesn't exist in the tox + invocation environment it is ignored. You can use ``*`` and ``?`` to + match multiple environment variables with one name. + + Note that the ``PATH`` variable is unconditionally passed down and on + Windows ``SYSTEMROOT`` and ``PATHEXT`` will be passed down as well. + You can override these variables with the ``setenv`` option. + .. confval:: recreate=True|False(default) Always recreate virtual environment if this option is True. diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -173,6 +173,22 @@ would trigger a complete reinstallation of the existing py27 environment (or create it afresh if it doesn't exist). +passing down environment variables +------------------------------------------- + +.. versionadded:: 2.0 + +By default tox will only pass the ``PATH`` environment variable (and on +windows ``SYSTEMROOT`` and ``PATHEXT``) from the tox invocation to the +test environments. If you want to pass down additional environment +variables you can use the ``passenv`` option:: + + [testenv] + passenv = LANG + +When your test commands execute they will execute with +the same LANG setting as the one with which tox was invoked. + setting environment variables ------------------------------------------- diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 setup.cfg --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 setup.py --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='1.9.3.dev1', + version='2.0.0.dev1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -642,6 +642,43 @@ assert envconfig.setenv['PYTHONPATH'] == 'something' assert envconfig.setenv['ANOTHER_VAL'] == 'else' + @pytest.mark.parametrize("plat", ["win32", "linux2"]) + def test_passenv(self, tmpdir, newconfig, monkeypatch, plat): + monkeypatch.setattr(sys, "platform", plat) + monkeypatch.setenv("A123A", "a") + monkeypatch.setenv("A123B", "b") + monkeypatch.setenv("BX23", "0") + config = newconfig(""" + [testenv] + passenv = A123* B?23 + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['python'] + if plat == "win32": + assert "PATHEXT" in envconfig.passenv + assert "SYSTEMROOT" in envconfig.passenv + assert "PATH" in envconfig.passenv + assert "A123A" in envconfig.passenv + assert "A123B" in envconfig.passenv + + def test_passenv_with_factor(self, tmpdir, newconfig, monkeypatch): + monkeypatch.setenv("A123A", "a") + monkeypatch.setenv("A123B", "b") + monkeypatch.setenv("BX23", "0") + config = newconfig(""" + [tox] + envlist = {x1,x2} + [testenv] + passenv = + x1: A123A + x2: A123B + """) + assert len(config.envconfigs) == 2 + assert "A123A" in config.envconfigs["x1"].passenv + assert "A123B" not in config.envconfigs["x1"].passenv + assert "A123B" in config.envconfigs["x2"].passenv + assert "A123A" not in config.envconfigs["x2"].passenv + def test_changedir_override(self, tmpdir, newconfig): config = newconfig(""" [testenv] diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -517,11 +517,13 @@ assert 'PIP_REQUIRE_VIRTUALENV' not in os.environ assert '__PYVENV_LAUNCHER__' not in os.environ -def test_setenv_added_to_pcall(tmpdir, mocksession, newconfig): +def test_env_variables_added_to_pcall(tmpdir, mocksession, newconfig, monkeypatch): pkg = tmpdir.ensure("package.tar.gz") + monkeypatch.setenv("X123", "123") config = newconfig([], """ [testenv:python] commands=python -V + passenv = X123 setenv = ENV_VAR = value """) @@ -540,9 +542,12 @@ assert 'ENV_VAR' in env assert env['ENV_VAR'] == 'value' assert env['VIRTUAL_ENV'] == str(venv.path) + assert env['X123'] == "123" - for e in os.environ: - assert e in env + assert set(env) == set(["ENV_VAR", "VIRTUAL_ENV", "PYTHONHASHSEED", + "X123", "PATH"]) + #for e in os.environ: + # assert e in env def test_installpkg_no_upgrade(tmpdir, newmocksession): pkg = tmpdir.ensure("package.tar.gz") diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '1.9.3.dev1' +__version__ = '2.0.0.dev1' class exception: class Error(Exception): diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -1,6 +1,7 @@ import argparse import os import random +from fnmatch import fnmatchcase import sys import re import shlex @@ -366,6 +367,17 @@ if config.hashseed is not None: setenv['PYTHONHASHSEED'] = config.hashseed setenv.update(reader.getdict(section, 'setenv')) + + # read passenv + vc.passenv = set(["PATH"]) + if sys.platform == "win32": + vc.passenv.add("SYSTEMROOT") # needed for python's crypto module + vc.passenv.add("PATHEXT") # needed for discovering executables + for spec in reader.getlist(section, "passenv", sep=" "): + for name in os.environ: + if fnmatchcase(name, spec): + vc.passenv.add(name) + vc.setenv = setenv if not vc.setenv: vc.setenv = None diff -r 1877e74ab9b82b8a7d1818dd623edf2f6f2ea822 -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -326,7 +326,10 @@ action=action, extraenv=extraenv) def _getenv(self, extraenv={}): - env = os.environ.copy() + env = {} + for envname in self.envconfig.passenv: + if envname in os.environ: + env[envname] = os.environ[envname] setenv = self.envconfig.setenv if setenv: env.update(setenv) https://bitbucket.org/hpk42/tox/commits/385a38e6afca/ Changeset: 385a38e6afca User: hpk42 Date: 2015-04-21 09:59:54+00:00 Summary: remove the long-deprecated "distribute" option as it has no effect these days. Affected #: 8 files diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ If platform is set and doesn't match the platform spec in the test environment the test environment is ignored, no setup or tests are attempted. +- remove the long-deprecated "distribute" option as it has no effect these days. 1.9.2 ----------- diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -37,7 +37,7 @@ -rm -rf $(BUILDDIR)/* install: clean html - @rsync -avz $(BUILDDIR)/html/ testrun.org:/www/testrun.org/tox/latest + @rsync -avz $(BUILDDIR)/html/ testrun.org:/www/testrun.org/tox/dev #latexpdf #@scp $(BUILDDIR)/latex/*.pdf testrun.org:www-tox/latest diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -200,15 +200,6 @@ `--download-cache` command-line option. **default**: no download cache will be used. -.. confval:: distribute=True|False - - **DEPRECATED** -- as of August 2013 you should use setuptools - which has merged most of distribute_ 's changes. Just use - the default, Luke! In future versions of tox this option might - be ignored and setuptools always chosen. - - **default:** False. - .. confval:: sitepackages=True|False Set to ``True`` if you want to create virtual environments that also diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc doc/links.txt --- a/doc/links.txt +++ b/doc/links.txt @@ -13,7 +13,6 @@ .. _`easy_install`: http://peak.telecommunity.com/DevCenter/EasyInstall .. _pip: https://pypi.python.org/pypi/pip .. _setuptools: https://pypi.python.org/pypi/setuptools -.. _distribute: https://pypi.python.org/pypi/distribute .. _`jenkins`: http://jenkins-ci.org/ .. _sphinx: https://pypi.python.org/pypi/Sphinx .. _discover: https://pypi.python.org/pypi/discover diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -543,7 +543,6 @@ envconfig = config.envconfigs['python'] assert envconfig.commands == [["xyz", "--abc"]] assert envconfig.changedir == config.setupdir - assert envconfig.distribute == False assert envconfig.sitepackages == False assert envconfig.develop == False assert envconfig.envlogdir == envconfig.envdir.join("log") diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -80,22 +80,6 @@ p = venv.getcommandpath("easy_install") assert py.path.local(p).relto(envconfig.envbindir), p -def test_create_distribute(monkeypatch, mocksession, newconfig): - config = newconfig([], """ - [testenv:py123] - distribute=False - """) - envconfig = config.envconfigs['py123'] - venv = VirtualEnv(envconfig, session=mocksession) - assert venv.path == envconfig.envdir - assert not venv.path.check() - venv.create() - l = mocksession._pcalls - assert len(l) >= 1 - args = l[0].args - assert "--distribute" not in map(str, args) - assert "--setuptools" in map(str, args) - def test_create_sitepackages(monkeypatch, mocksession, newconfig): config = newconfig([], """ [testenv:site] @@ -158,7 +142,6 @@ monkeypatch.delenv("PIP_DOWNLOAD_CACHE", raising=False) mocksession = newmocksession([], """ [testenv:py123] - distribute=True deps= dep1 dep2 @@ -458,18 +441,6 @@ venv.update() mocksession.report.expect("*", "*recreate*") - def test_distribute_recreation(self, newconfig, mocksession): - config = newconfig([], "") - envconfig = config.envconfigs['python'] - venv = VirtualEnv(envconfig, session=mocksession) - venv.update() - cconfig = venv._getliveconfig() - cconfig.distribute = True - cconfig.writeconfig(venv.path_config) - mocksession._clearmocks() - venv.update() - mocksession.report.expect("verbosity0", "*recreate*") - def test_develop_recreation(self, newconfig, mocksession): config = newconfig([], "") envconfig = config.envconfigs['python'] @@ -523,7 +494,7 @@ config = newconfig([], """ [testenv:python] commands=python -V - passenv = X123 + passenv = x123 setenv = ENV_VAR = value """) @@ -544,8 +515,9 @@ assert env['VIRTUAL_ENV'] == str(venv.path) assert env['X123'] == "123" - assert set(env) == set(["ENV_VAR", "VIRTUAL_ENV", "PYTHONHASHSEED", - "X123", "PATH"]) + assert set(["ENV_VAR", "VIRTUAL_ENV", "PYTHONHASHSEED", "X123", "PATH"])\ + .issubset(env) + #for e in os.environ: # assert e in env diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -375,7 +375,7 @@ vc.passenv.add("PATHEXT") # needed for discovering executables for spec in reader.getlist(section, "passenv", sep=" "): for name in os.environ: - if fnmatchcase(name, spec): + if fnmatchcase(name.lower(), spec.lower()): vc.passenv.add(name) vc.setenv = setenv @@ -403,7 +403,6 @@ break vc.platform = platform - vc.distribute = reader.getbool(section, "distribute", False) vc.sitepackages = self.config.option.sitepackages or \ reader.getbool(section, "sitepackages", False) diff -r 49f0a9981117a5ca9b598dd52b2f831b86df57f2 -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -7,20 +7,18 @@ from tox._config import DepConfig class CreationConfig: - def __init__(self, md5, python, version, distribute, sitepackages, + def __init__(self, md5, python, version, sitepackages, develop, deps): self.md5 = md5 self.python = python self.version = version - self.distribute = distribute self.sitepackages = sitepackages self.develop = develop self.deps = deps def writeconfig(self, path): lines = ["%s %s" % (self.md5, self.python)] - lines.append("%s %d %d %d" % (self.version, self.distribute, - self.sitepackages, self.develop)) + lines.append("%s %d %d" % (self.version, self.sitepackages, self.develop)) for dep in self.deps: lines.append("%s %s" % dep) path.ensure() @@ -32,27 +30,21 @@ lines = path.readlines(cr=0) value = lines.pop(0).split(None, 1) md5, python = value - version, distribute, sitepackages, develop = lines.pop(0).split( - None, 3) - distribute = bool(int(distribute)) + version, sitepackages, develop = lines.pop(0).split(None, 3) sitepackages = bool(int(sitepackages)) develop = bool(int(develop)) deps = [] for line in lines: md5, depstring = line.split(None, 1) deps.append((md5, depstring)) - return CreationConfig(md5, python, version, - distribute, sitepackages, develop, deps) - except KeyboardInterrupt: - raise - except: + return CreationConfig(md5, python, version, sitepackages, develop, deps) + except Exception: return None def matches(self, other): return (other and self.md5 == other.md5 and self.python == other.python and self.version == other.version - and self.distribute == other.distribute and self.sitepackages == other.sitepackages and self.develop == other.develop and self.deps == other.deps) @@ -148,7 +140,6 @@ python = self.envconfig._basepython_info.executable md5 = getdigest(python) version = tox.__version__ - distribute = self.envconfig.distribute sitepackages = self.envconfig.sitepackages develop = self.envconfig.develop deps = [] @@ -157,7 +148,7 @@ md5 = getdigest(raw_dep) deps.append((md5, raw_dep)) return CreationConfig(md5, python, version, - distribute, sitepackages, develop, deps) + sitepackages, develop, deps) def _getresolvedeps(self): l = [] @@ -183,10 +174,6 @@ config_interpreter = self.getsupportedinterpreter() args = [sys.executable, '-m', 'virtualenv'] - if self.envconfig.distribute: - args.append("--distribute") - else: - args.append("--setuptools") if self.envconfig.sitepackages: args.append('--system-site-packages') # add interpreter explicitly, to prevent using https://bitbucket.org/hpk42/tox/commits/7fb0ae11640d/ Changeset: 7fb0ae11640d User: hpk42 Date: 2015-04-21 14:39:13+00:00 Summary: fix issue233: avoid hanging with tox-setuptools integration example. Thanks simonb. Affected #: 2 files diff -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc -r 7fb0ae11640dc5416ba58d58e2858cfe7d7f7c07 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,8 @@ - remove the long-deprecated "distribute" option as it has no effect these days. +- fix issue233: avoid hanging with tox-setuptools integration example. Thanks simonb. + 1.9.2 ----------- diff -r 385a38e6afca771820ffd44ee23348ebb3fcf0bc -r 7fb0ae11640dc5416ba58d58e2858cfe7d7f7c07 doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -254,7 +254,10 @@ #import here, cause outside the eggs aren't loaded import tox import shlex - errno = tox.cmdline(args=shlex.split(self.tox_args)) + args = self.tox_args + if args: + args = shlex.split(self.tox_args) + errno = tox.cmdline(args=args) sys.exit(errno) setup( 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 https://mail.python.org/mailman/listinfo/pytest-commit