Skip to content

Commit

Permalink
Show only default env list for tox config by default
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 15, 2022
1 parent 12f6268 commit c321420
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
1 change: 1 addition & 0 deletions docs/changelog/2722.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``tox config`` should only show :ref:`env_list` arguments by default instead of ``ALL`` - by :user:`gaborbernat`.
4 changes: 2 additions & 2 deletions src/tox/session/cmd/show_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def tox_add_option(parser: ToxParser) -> None:
our.add_argument(
"--core",
action="store_true",
help="show core options too when selecting an env with -e",
help="show core options (by default is hidden unless -e ALL is passed)",
dest="show_core",
)
register_env_select_flags(our, default=CliEnv("ALL"))
register_env_select_flags(our, default=CliEnv())
env_run_create_flags(our, mode="config")


Expand Down
13 changes: 3 additions & 10 deletions tests/config/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,8 @@ def test_args_are_paths_when_with_change_dir(tox_project: ToxProjectCreator) ->

def test_relative_config_paths_resolve(tox_project: ToxProjectCreator) -> None:
project = tox_project({"tox.ini": "[tox]"})
result = project.run(
"c",
"-c",
str(Path(project.path.name) / "tox.ini"),
"-k",
"change_dir",
"env_dir",
from_cwd=project.path.parent,
)
ini = str(Path(project.path.name) / "tox.ini")
result = project.run("c", "-c", ini, "-k", "change_dir", "env_dir", from_cwd=project.path.parent)
result.assert_success()
expected = f"[testenv:py]\nchange_dir = {project.path}\nenv_dir = {project.path / '.tox' / 'py'}\n\n[tox]\n"
expected = f"[testenv:py]\nchange_dir = {project.path}\nenv_dir = {project.path / '.tox' / 'py'}\n"
assert result.out == expected
14 changes: 6 additions & 8 deletions tests/session/cmd/test_show_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ def test_show_config_pkg_env_once(
patch_prev_py: Callable[[bool], tuple[str, str]],
) -> None:
prev_ver, impl = patch_prev_py(True)
project = tox_project(
{"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""},
)
result = project.run("c")
ini = f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel"
project = tox_project({"tox.ini": ini, "pyproject.toml": ""})
result = project.run("c", "-e", "ALL")
result.assert_success()
parser = ConfigParser(interpolation=None)
parser.read_string(result.out)
Expand All @@ -145,10 +144,9 @@ def test_show_config_pkg_env_skip(
patch_prev_py: Callable[[bool], tuple[str, str]],
) -> None:
prev_ver, impl = patch_prev_py(False)
project = tox_project(
{"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""},
)
result = project.run("c")
ini = f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel"
project = tox_project({"tox.ini": ini, "pyproject.toml": ""})
result = project.run("c", "-e", "ALL")
result.assert_success()
parser = ConfigParser(interpolation=None)
parser.read_string(result.out)
Expand Down
2 changes: 1 addition & 1 deletion tests/tox_env/test_tox_env_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_tox_env_pass_env_fails_on_whitespace(tox_project: ToxProjectCreator) ->
result.assert_success()
msg = (
'[testenv:py]\npass_env = # Exception: Fail("pass_env values cannot contain whitespace, use comma to have '
f'multiple values in a single line, invalid values found {first!r}, {second!r}")\n\n[tox]\n'
f'multiple values in a single line, invalid values found {first!r}, {second!r}")\n'
)
assert result.out == msg

Expand Down

0 comments on commit c321420

Please sign in to comment.