Skip to content

Add a --no-skip-missing-interpreters option #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions tests/test_z_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
13 changes: 10 additions & 3 deletions tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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')}
Expand Down