Skip to content

Show only default env list for tox config by default #2726

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

Merged
merged 1 commit into from
Dec 15, 2022
Merged
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
1 change: 1 addition & 0 deletions docs/changelog/2726.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