From 37947b687b27bd8e0a8921d22502629b240c6ecb Mon Sep 17 00:00:00 2001 From: Eugene Yunak Date: Wed, 18 Jun 2014 12:09:13 +0300 Subject: add support for setting skip_missing_interpreters as a config option and not just a command line flag --- CHANGELOG | 3 ++- CONTRIBUTORS | 1 + doc/config.txt | 7 +++++++ tests/test_config.py | 8 ++++++++ tox/_config.py | 4 ++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 73408b3..b4e7155 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,7 +7,8 @@ development resulting in a more refined behaviour in the 1.8 series. And thanks to Clark Boylan for the PR. -- fix issue59: add option "--skip-missing-interpreters" which won't fail the +- fix issue59: add a config variable ``skip-missing-interpreters`` as well as + command line option ``--skip-missing-interpreters`` which won't fail the build if Python interpreters listed in tox.ini are missing. Thanks Alexandre Conrad for PR104. diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 25c7788..d10950b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -27,3 +27,4 @@ Alexandre Conrad Morgan Fainberg Marc Schlaich Clark Boylan +Eugene Yunak diff --git a/doc/config.txt b/doc/config.txt index a6ca4c8..fd7f79f 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -22,6 +22,7 @@ List of optional global options:: distshare=path # defaults to {homedir}/.tox/distshare envlist=ENVLIST # defaults to the list of all environments skipsdist=BOOL # defaults to false + skip_missing_interpreters=BOOL # defaults to false ``tox`` autodetects if it is running in a Jenkins_ context @@ -32,6 +33,12 @@ and will first lookup global tox settings in this section:: ... # override [tox] settings for the jenkins context # note: for jenkins distshare defaults to ``{toxworkdir}/distshare``. +Setting ``skip_missing_interpreters`` to ``True`` is equivalent of passing the +``--skip-missing-interpreters`` command line option, and will force ``tox`` to +return success even if some of the specified environments were missing. This is +useful for some CI systems or running on a developer box, where you might only +have a subset of all your supported interpreters installed but don't want to +mark the build as failed because of it. envlist setting +++++++++++++++ diff --git a/tests/test_config.py b/tests/test_config.py index c55f43a..86f93e7 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -943,6 +943,14 @@ class TestGlobalOptions: config = newconfig([], inisource) assert config.minversion == "3.0" + def test_skip_missing_interpreters(self, tmpdir, newconfig, monkeypatch): + inisource = """ + [tox] + skip_missing_interpreters = True + """ + config = newconfig([], inisource) + assert config.option.skip_missing_interpreters + def test_defaultenv_commandline(self, tmpdir, newconfig, monkeypatch): config = newconfig(["-epy24"], "") env = config.envconfigs['py24'] diff --git a/tox/_config.py b/tox/_config.py index 0a9dc1a..45d626a 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -239,6 +239,10 @@ class parseini: "{toxinidir}/.tox") config.minversion = reader.getdefault(toxsection, "minversion", None) + if not config.option.skip_missing_interpreters: + config.option.skip_missing_interpreters = \ + reader.getdefault(toxsection, "skip_missing_interpreters", None) + # determine indexserver dictionary config.indexserver = {'default': IndexServerConfig('default')} prefix = "indexserver" -- cgit v1.2.1 From e9011ab3375632098a7d8877927b746b407c41e7 Mon Sep 17 00:00:00 2001 From: Eugene Yunak Date: Wed, 18 Jun 2014 12:53:27 +0300 Subject: skip_missing_interpreters: fix bool handling and add appropriate test, thanks hpk42@ for the tip! --- tests/test_config.py | 10 +++++++++- tox/_config.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 86f93e7..ff743c4 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -943,7 +943,7 @@ class TestGlobalOptions: config = newconfig([], inisource) assert config.minversion == "3.0" - def test_skip_missing_interpreters(self, tmpdir, newconfig, monkeypatch): + def test_skip_missing_interpreters_true(self, tmpdir, newconfig, monkeypatch): inisource = """ [tox] skip_missing_interpreters = True @@ -951,6 +951,14 @@ class TestGlobalOptions: config = newconfig([], inisource) assert config.option.skip_missing_interpreters + def test_skip_missing_interpreters_false(self, tmpdir, newconfig, monkeypatch): + inisource = """ + [tox] + skip_missing_interpreters = False + """ + config = newconfig([], inisource) + assert not config.option.skip_missing_interpreters + def test_defaultenv_commandline(self, tmpdir, newconfig, monkeypatch): config = newconfig(["-epy24"], "") env = config.envconfigs['py24'] diff --git a/tox/_config.py b/tox/_config.py index 45d626a..4f89d00 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -241,7 +241,7 @@ class parseini: if not config.option.skip_missing_interpreters: config.option.skip_missing_interpreters = \ - reader.getdefault(toxsection, "skip_missing_interpreters", None) + reader.getbool(toxsection, "skip_missing_interpreters", False) # determine indexserver dictionary config.indexserver = {'default': IndexServerConfig('default')} -- cgit v1.2.1 From 82bc07071e538b45156ce2baecf747f639559740 Mon Sep 17 00:00:00 2001 From: Eugene Yunak Date: Wed, 18 Jun 2014 13:03:34 +0300 Subject: skip_missing_interpreters: move documentation into a separate confval section --- doc/config.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/config.txt b/doc/config.txt index fd7f79f..23bf128 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -22,7 +22,6 @@ List of optional global options:: distshare=path # defaults to {homedir}/.tox/distshare envlist=ENVLIST # defaults to the list of all environments skipsdist=BOOL # defaults to false - skip_missing_interpreters=BOOL # defaults to false ``tox`` autodetects if it is running in a Jenkins_ context @@ -33,12 +32,18 @@ and will first lookup global tox settings in this section:: ... # override [tox] settings for the jenkins context # note: for jenkins distshare defaults to ``{toxworkdir}/distshare``. -Setting ``skip_missing_interpreters`` to ``True`` is equivalent of passing the -``--skip-missing-interpreters`` command line option, and will force ``tox`` to -return success even if some of the specified environments were missing. This is -useful for some CI systems or running on a developer box, where you might only -have a subset of all your supported interpreters installed but don't want to -mark the build as failed because of it. +.. confval:: skip_missing_interpreters=BOOL + + .. versionadded:: 1.7.2 + + Setting this to ``True`` is equivalent of passing the + ``--skip-missing-interpreters`` command line option, and will force ``tox`` to + return success even if some of the specified environments were missing. This is + useful for some CI systems or running on a developer box, where you might only + have a subset of all your supported interpreters installed but don't want to + mark the build as failed because of it. As expected, the command line switch + always overrides this setting if passed on the invokation. + **Default:** ``False`` envlist setting +++++++++++++++ -- cgit v1.2.1