[Python-modules-commits] [tox] 01/15: Import tox_2.2.1.orig.tar.gz

Barry Warsaw barry at moszumanska.debian.org
Fri Nov 20 21:45:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

barry pushed a commit to branch master
in repository tox.

commit af0fa1138402eb639d11846a51733fab2b04ce53
Author: Barry Warsaw <barry at ubuntu.com>
Date:   Fri Nov 20 16:10:36 2015 -0500

    Import tox_2.2.1.orig.tar.gz
---
 CHANGELOG               | 31 +++++++++++++++++
 CONTRIBUTORS            |  1 +
 PKG-INFO                |  2 +-
 doc/conf.py             |  4 +--
 doc/config.txt          |  9 +++++
 setup.cfg               | 11 ++++++
 setup.py                |  2 +-
 tests/test_config.py    | 90 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/test_venv.py      | 15 +++++++++
 tests/test_z_cmdline.py | 19 +++++++++--
 tox.egg-info/PKG-INFO   |  2 +-
 tox/__init__.py         |  2 +-
 tox/config.py           | 57 ++++++++++++++++++-------------
 tox/session.py          |  3 ++
 tox/venv.py             |  7 ++++
 15 files changed, 224 insertions(+), 31 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 54ea8be..11ecb1f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,34 @@
+2.2.1
+-----
+
+- fix bug where {envdir} substitution could not be used in setenv
+  if that env value is then used in {basepython}. Thanks Florian Bruhin.
+
+2.2.0
+-----
+
+- fix issue265 and add LD_LIBRARY_PATH to passenv on linux by default
+  because otherwise the python interpreter might not start up in
+  certain configurations (redhat software collections).  Thanks David Riddle.
+
+- fix issue246: fix regression in config parsing by reordering 
+  such that {envbindir} can be used again in tox.ini. Thanks Olli Walsh.
+
+- fix issue99: the {env:...} substitution now properly uses environment
+  settings from the ``setenv`` section. Thanks Itxaka Serrano.
+
+- fix issue281: make --force-deps work when urls are present in
+  dependency configs.  Thanks Glyph Lefkowitz for reporting.
+
+- fix issue174: add new ``ignore_outcome`` testenv attribute which
+  can be set to True in which case it will produce a warning instead
+  of an error on a failed testenv command outcome.  
+  Thanks Rebecka Gulliksson for the PR.
+
+- fix issue280: properly skip missing interpreter if
+  {envsitepackagesdir} is present in commands. Thanks BB:ceridwenv
+
+
 2.1.1
 ----------
 
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b3e523e..75a2dd8 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -31,3 +31,4 @@ Marc Schlaich
 Clark Boylan
 Eugene Yunak
 Mark Hirota
+Itxaka Serrano
diff --git a/PKG-INFO b/PKG-INFO
index 7e64fc6..c90524b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: tox
-Version: 2.1.1
+Version: 2.2.1
 Summary: virtualenv-based automation of test activities
 Home-page: http://tox.testrun.org/
 Author: holger krekel
diff --git a/doc/conf.py b/doc/conf.py
index 630cb80..79857d7 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -48,8 +48,8 @@ copyright = u'2015, holger krekel and others'
 # built documents.
 #
 # The short X.Y version.
-release = "2.1"
-version = "2.1.0"
+release = "2.2"
+version = "2.2.0"
 # 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 ed9290c..8bfa57d 100644
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -302,6 +302,15 @@ Complete list of settings that you can put into ``testenv*`` sections:
 
     **default**: ``False``
 
+.. confval:: ignore_outcome=BOOL
+
+    .. versionadded:: 2.2
+
+    If set to True a failing result of this testenv will not make tox fail,
+    only a warning will be produced.
+
+    **default**: ``False``
+
 
 Substitutions
 -------------
diff --git a/setup.cfg b/setup.cfg
index 6f08d0e..bec4469 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,17 @@
+[build_sphinx]
+source-dir = doc/en/
+build-dir = doc/build
+all_files = 1
+
+[upload_sphinx]
+upload-dir = doc/en/build/html
+
 [bdist_wheel]
 universal = 1
 
+[devpi:upload]
+formats = sdist.tgz,bdist_wheel
+
 [egg_info]
 tag_build = 
 tag_date = 0
diff --git a/setup.py b/setup.py
index a72a5fc..a398ade 100644
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def main():
         description='virtualenv-based automation of test activities',
         long_description=open("README.rst").read(),
         url='http://tox.testrun.org/',
-        version='2.1.1',
+        version='2.2.1',
         license='http://opensource.org/licenses/MIT',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
         author='holger krekel',
diff --git a/tests/test_config.py b/tests/test_config.py
index 8aa7abd..61047c1 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -88,6 +88,26 @@ class TestVenvConfig:
             'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0',
         ]
 
+    def test_force_dep_with_url(self, initproj):
+        initproj("example123-0.5", filedefs={
+            'tox.ini': '''
+            [tox]
+
+            [testenv]
+            deps=
+                dep1==1.0
+                https://pypi.python.org/xyz/pkg1.tar.gz
+            '''
+        })
+        config = parseconfig(
+            ['--force-dep=dep1==1.5'])
+        assert config.option.force_dep == [
+            'dep1==1.5'
+        ]
+        assert [str(x) for x in config.envconfigs['python'].deps] == [
+            'dep1==1.5', 'https://pypi.python.org/xyz/pkg1.tar.gz'
+        ]
+
     def test_is_same_dep(self):
         """
         Ensure correct parseini._is_same_dep is working with a few samples.
@@ -254,6 +274,28 @@ class TestIniParserAgainstCommandsKey:
             ["echo", "cmd", "1", "2", "3", "4", "cmd", "2"],
         ]
 
+    def test_command_env_substitution(self, newconfig):
+        """Ensure referenced {env:key:default} values are substituted correctly."""
+        config = newconfig("""
+           [testenv:py27]
+           setenv =
+             TEST=testvalue
+           commands =
+             ls {env:TEST}
+        """)
+        reader = SectionReader("testenv:py27", config._cfg)
+        x = reader.getargvlist("commands")
+        assert x == [
+            "ls testvalue".split()
+        ]
+        assert x != [
+            "ls {env:TEST}".split()
+        ]
+        y = reader.getargvlist("setenv")
+        assert y == [
+            "TEST=testvalue".split()
+        ]
+
 
 class TestIniParser:
     def test_getstring_single(self, tmpdir, newconfig):
@@ -598,6 +640,7 @@ class TestConfigTestEnv:
         int_hashseed = int(hashseed)
         # hashseed is random by default, so we can't assert a specific value.
         assert int_hashseed > 0
+        assert envconfig.ignore_outcome is False
 
     def test_sitepackages_switch(self, tmpdir, newconfig):
         config = newconfig(["--sitepackages"], "")
@@ -695,6 +738,32 @@ class TestConfigTestEnv:
         assert envconfig.setenv['PYTHONPATH'] == 'something'
         assert envconfig.setenv['ANOTHER_VAL'] == 'else'
 
+    def test_setenv_with_envdir_and_basepython(self, tmpdir, newconfig):
+        config = newconfig("""
+            [testenv]
+            setenv =
+                VAL = {envdir}
+            basepython = {env:VAL}
+        """)
+        assert len(config.envconfigs) == 1
+        envconfig = config.envconfigs['python']
+        assert 'VAL' in envconfig.setenv
+        assert envconfig.setenv['VAL'] == envconfig.envdir
+        assert envconfig.basepython == envconfig.envdir
+
+    def test_setenv_ordering_1(self, tmpdir, newconfig):
+        config = newconfig("""
+            [testenv]
+            setenv=
+                VAL={envdir}
+            commands=echo {env:VAL}
+        """)
+        assert len(config.envconfigs) == 1
+        envconfig = config.envconfigs['python']
+        assert 'VAL' in envconfig.setenv
+        assert envconfig.setenv['VAL'] == envconfig.envdir
+        assert str(envconfig.envdir) in envconfig.commands[0]
+
     @pytest.mark.parametrize("plat", ["win32", "linux2"])
     def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, plat):
         monkeypatch.setattr(sys, "platform", plat)
@@ -721,6 +790,7 @@ class TestConfigTestEnv:
         assert "PATH" in envconfig.passenv
         assert "PIP_INDEX_URL" in envconfig.passenv
         assert "LANG" in envconfig.passenv
+        assert "LD_LIBRARY_PATH" in envconfig.passenv
         assert "A123A" in envconfig.passenv
         assert "A123B" in envconfig.passenv
 
@@ -926,6 +996,18 @@ class TestConfigTestEnv:
         assert argv[7][0] == config.homedir.join(".tox", "distshare")
         assert argv[8][0] == conf.envlogdir
 
+    def test_substitution_notfound_issue246(tmpdir, newconfig):
+        config = newconfig("""
+            [testenv:py27]
+            setenv =
+                FOO={envbindir}
+                BAR={envsitepackagesdir}
+        """)
+        conf = config.envconfigs['py27']
+        env = conf.setenv
+        assert 'FOO' in env
+        assert 'BAR' in env
+
     def test_substitution_positional(self, newconfig):
         inisource = """
             [testenv:py27]
@@ -1214,6 +1296,14 @@ class TestConfigTestEnv:
         assert [d.name for d in configs["py27-django1.6"].deps] \
             == ["Django==1.6"]
 
+    def test_ignore_outcome(self, newconfig):
+        inisource = """
+            [testenv]
+            ignore_outcome=True
+        """
+        config = newconfig([], inisource).envconfigs
+        assert config["python"].ignore_outcome is True
+
 
 class TestGlobalOptions:
     def test_notest(self, newconfig):
diff --git a/tests/test_venv.py b/tests/test_venv.py
index 7c6b05a..b454f5b 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -7,6 +7,7 @@ import tox.config
 from tox.venv import *  # noqa
 from tox.interpreters import NoInterpreterInfo
 
+
 # def test_global_virtualenv(capfd):
 #    v = VirtualEnv()
 #    l = v.list()
@@ -611,3 +612,17 @@ def test_command_relative_issue26(newmocksession, tmpdir, monkeypatch):
     x4 = venv.getcommandpath("x", cwd=tmpdir)
     assert x4.endswith(os.sep + 'x')
     mocksession.report.expect("warning", "*test command found but not*")
+
+
+def test_ignore_outcome_failing_cmd(newmocksession):
+    mocksession = newmocksession([], """
+        [testenv]
+        commands=testenv_fail
+        ignore_outcome=True
+    """)
+
+    venv = mocksession.getenv('python')
+    venv.test()
+    assert venv.status == "ignored failed command"
+    mocksession.report.expect("warning", "*command failed but result from "
+                                         "testenv is ignored*")
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index b288880..994d4ec 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -692,8 +692,7 @@ def test_installpkg(tmpdir, newconfig):
     assert sdist_path == p
 
 
- at pytest.mark.xfail("sys.platform == 'win32' and sys.version_info < (2,6)",
-                   reason="test needs better impl")
+ at pytest.mark.xfail("sys.platform == 'win32'", reason="test needs better impl")
 def test_envsitepackagesdir(cmd, initproj):
     initproj("pkg512-0.0.5", filedefs={
         'tox.ini': """
@@ -708,6 +707,22 @@ def test_envsitepackagesdir(cmd, initproj):
     """)
 
 
+ at pytest.mark.xfail("sys.platform == 'win32'", reason="test needs better impl")
+def test_envsitepackagesdir_skip_missing_issue280(cmd, initproj):
+    initproj("pkg513-0.0.5", filedefs={
+        'tox.ini': """
+        [testenv]
+        basepython=/usr/bin/qwelkjqwle
+        commands=
+            {envsitepackagesdir}
+    """})
+    result = cmd.run("tox", "--skip-missing-interpreters")
+    assert result.ret == 0
+    result.stdout.fnmatch_lines("""
+        SKIPPED:*qwelkj*
+    """)
+
+
 def verify_json_report_format(data, testenvs=True):
     assert data["reportversion"] == "1"
     assert data["toxversion"] == tox.__version__
diff --git a/tox.egg-info/PKG-INFO b/tox.egg-info/PKG-INFO
index 7e64fc6..c90524b 100644
--- a/tox.egg-info/PKG-INFO
+++ b/tox.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: tox
-Version: 2.1.1
+Version: 2.2.1
 Summary: virtualenv-based automation of test activities
 Home-page: http://tox.testrun.org/
 Author: holger krekel
diff --git a/tox/__init__.py b/tox/__init__.py
index b2fed05..c1e74fb 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -1,5 +1,5 @@
 #
-__version__ = '2.1.1'
+__version__ = '2.2.1'
 
 from .hookspecs import hookspec, hookimpl  # noqa
 
diff --git a/tox/config.py b/tox/config.py
index 092de2a..9f5aae3 100644
--- a/tox/config.py
+++ b/tox/config.py
@@ -141,7 +141,11 @@ class DepOption:
         same package, even if versions differ.
         """
         dep1_name = pkg_resources.Requirement.parse(dep1).project_name
-        dep2_name = pkg_resources.Requirement.parse(dep2).project_name
+        try:
+            dep2_name = pkg_resources.Requirement.parse(dep2).project_name
+        except pkg_resources.RequirementParseError:
+            # we couldn't parse a version, probably a URL
+            return False
         return dep1_name == dep2_name
 
 
@@ -320,11 +324,23 @@ def tox_addoption(parser):
                         help="additional arguments available to command positional substitution")
 
     # add various core venv interpreter attributes
-
     parser.add_testenv_attribute(
         name="envdir", type="path", default="{toxworkdir}/{envname}",
         help="venv directory")
 
+    def basepython_default(testenv_config, value):
+        if value is None:
+            for f in testenv_config.factors:
+                if f in default_factors:
+                    return default_factors[f]
+            return sys.executable
+        return str(value)
+
+    parser.add_testenv_attribute(
+        name="basepython", type="string", default=None, postprocess=basepython_default,
+        help="executable name or path of interpreter used to create a "
+             "virtual test environment.")
+
     parser.add_testenv_attribute(
         name="envtmpdir", type="path", default="{envdir}/tmp",
         help="venv temporary directory")
@@ -386,7 +402,7 @@ def tox_addoption(parser):
             itertools.chain.from_iterable(
                 [x.split(' ') for x in value]))
 
-        passenv = set(["PATH", "PIP_INDEX_URL", "LANG"])
+        passenv = set(["PATH", "PIP_INDEX_URL", "LANG", "LD_LIBRARY_PATH"])
 
         # read in global passenv settings
         p = os.environ.get("TOX_TESTENV_PASSENV", None)
@@ -453,19 +469,6 @@ def tox_addoption(parser):
         name="usedevelop", type="bool", postprocess=develop, default=False,
         help="install package in develop/editable mode")
 
-    def basepython_default(testenv_config, value):
-        if value is None:
-            for f in testenv_config.factors:
-                if f in default_factors:
-                    return default_factors[f]
-            return sys.executable
-        return str(value)
-
-    parser.add_testenv_attribute(
-        name="basepython", type="string", default=None, postprocess=basepython_default,
-        help="executable name or path of interpreter used to create a "
-             "virtual test environment.")
-
     parser.add_testenv_attribute_obj(InstallcmdOption())
     parser.add_testenv_attribute_obj(DepOption())
 
@@ -473,6 +476,11 @@ def tox_addoption(parser):
         name="commands", type="argvlist", default="",
         help="each line specifies a test command and can use substitution.")
 
+    parser.add_testenv_attribute(
+        "ignore_outcome", type="bool", default=False,
+        help="if set to True a failing result of this testenv will not make "
+             "tox fail, only a warning will be produced")
+
 
 class Config(object):
     """ Global Tox config object. """
@@ -531,7 +539,6 @@ class TestenvConfig:
         """ return sitepackagesdir of the virtualenv environment.
         (only available during execution, not parsing)
         """
-        self.getsupportedinterpreter()  # for throwing exceptions
         x = self.config.interpreters.get_sitepackagesdir(
             info=self.python_info,
             envdir=self.envdir)
@@ -709,7 +716,7 @@ class parseini:
             if atype == "path":
                 reader.addsubstitutions(**{env_attr.name: res})
 
-            if env_attr.name == "install_command":
+            if env_attr.name == "basepython":
                 reader.addsubstitutions(envbindir=vc.envbindir, envpython=vc.envpython,
                                         envsitepackagesdir=vc.envsitepackagesdir)
         return vc
@@ -903,6 +910,7 @@ class SectionReader:
         return '\n'.join(filter(None, map(factor_line, lines)))
 
     def _replace_env(self, match):
+        env_list = self.getdict('setenv')
         match_value = match.group('substitution_value')
         if not match_value:
             raise tox.exception.ConfigError(
@@ -917,11 +925,14 @@ class SectionReader:
             envkey = match_value
 
         if envkey not in os.environ and default is None:
-            raise tox.exception.ConfigError(
-                "substitution env:%r: unknown environment variable %r" %
-                (envkey, envkey))
-
-        return os.environ.get(envkey, default)
+            if envkey not in env_list and default is None:
+                raise tox.exception.ConfigError(
+                    "substitution env:%r: unknown environment variable %r" %
+                    (envkey, envkey))
+        if envkey in os.environ:
+            return os.environ.get(envkey, default)
+        else:
+            return env_list.get(envkey, default)
 
     def _substitute_from_other_section(self, key):
         if key.startswith("[") and "]" in key:
diff --git a/tox/session.py b/tox/session.py
index fcdcf6c..b5176f9 100644
--- a/tox/session.py
+++ b/tox/session.py
@@ -570,6 +570,9 @@ class Session:
             elif status == "platform mismatch":
                 msg = "  %s: %s" % (venv.envconfig.envname, str(status))
                 self.report.skip(msg)
+            elif status and status == "ignored failed command":
+                msg = "  %s: %s" % (venv.envconfig.envname, str(status))
+                self.report.good(msg)
             elif status and status != "skipped tests":
                 msg = "  %s: %s" % (venv.envconfig.envname, str(status))
                 self.report.error(msg)
diff --git a/tox/venv.py b/tox/venv.py
index 7990330..eaa555a 100644
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -351,6 +351,13 @@ class VirtualEnv(object):
                     self._pcall(argv, cwd=cwd, action=action, redirect=redirect,
                                 ignore_ret=ignore_ret, testcommand=True)
                 except tox.exception.InvocationError as err:
+                    if self.envconfig.ignore_outcome:
+                        self.session.report.warning(
+                            "command failed but result from testenv is ignored\n"
+                            "  cmd: %s" % (str(err),))
+                        self.status = "ignored failed command"
+                        continue  # keep processing commands
+
                     self.session.report.error(str(err))
                     self.status = "commands failed"
                     if not self.envconfig.ignore_errors:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/tox.git



More information about the Python-modules-commits mailing list