diff --git a/doc/config.rst b/doc/config.rst index fbde747a0..4e5b996eb 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -45,6 +45,12 @@ and will first lookup global tox settings in this section:: always overrides this setting if passed on the invokation. **Default:** ``False`` + .. versionadded:: (unreleased) + + The ``--no-skip-missing-interpreters`` command line option can also be used + to override the configuration value to *ensure* failure on missing + interpreters. + .. confval:: envlist=CSV Determining the environment list that ``tox`` is to operate on diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index a856c2f46..0e90451b9 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -330,6 +330,26 @@ def test_skip_unknown_interpreter(cmd, initproj): ]) +def test_no_skip_missing_interpreters(cmd, initproj): + initproj("interp123-0.5", filedefs={ + 'tests': {'test_hello.py': "def test_hello(): pass"}, + 'tox.ini': ''' + [tox] + skip_missing_interpreters = True + [testenv:python] + basepython=xyz_unknown_interpreter + [testenv] + changedir=tests + ''' + }) + result = cmd.run("tox", "--no-skip-missing-interpreters") + # Unlike `test_skip_unknown_intepreter`, this should fail + assert result.ret + result.stdout.fnmatch_lines([ + "*ERROR*InterpreterNotFound*xyz_unknown_interpreter*", + ]) + + def test_unknown_dep(cmd, initproj): initproj("dep123-0.7", filedefs={ 'tests': {'test_hello.py': "def test_hello(): pass"}, diff --git a/tox/config.py b/tox/config.py index de13eccd7..5b07f253e 100755 --- a/tox/config.py +++ b/tox/config.py @@ -387,7 +387,13 @@ def tox_addoption(parser): parser.add_argument("--alwayscopy", action="store_true", help="override alwayscopy setting to True in all envs") parser.add_argument("--skip-missing-interpreters", action="store_true", + default=None, help="don't fail tests for missing interpreters") + parser.add_argument( + '--no-skip-missing-interpreters', action='store_false', + dest='skip_missing_interpreters', + help='Ensure failure when interpreters are missing.', + ) parser.add_argument("--workdir", action="store", dest="workdir", metavar="PATH", default=None, help="tox working directory") @@ -749,9 +755,10 @@ def __init__(self, config, inipath): else: config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True) - if not config.option.skip_missing_interpreters: - config.option.skip_missing_interpreters = \ - reader.getbool("skip_missing_interpreters", False) + if config.option.skip_missing_interpreters is None: + config.option.skip_missing_interpreters = reader.getbool( + 'skip_missing_interpreters', False, + ) # determine indexserver dictionary config.indexserver = {'default': IndexServerConfig('default')}