Skip to content

Commit bfd9191

Browse files
authored
Show only default env list for tox config by default (#2726)
1 parent a633523 commit bfd9191

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

docs/changelog/2726.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``tox config`` should only show :ref:`env_list` arguments by default instead of ``ALL`` - by :user:`gaborbernat`.

src/tox/session/cmd/show_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def tox_add_option(parser: ToxParser) -> None:
3232
our.add_argument(
3333
"--core",
3434
action="store_true",
35-
help="show core options too when selecting an env with -e",
35+
help="show core options (by default is hidden unless -e ALL is passed)",
3636
dest="show_core",
3737
)
38-
register_env_select_flags(our, default=CliEnv("ALL"))
38+
register_env_select_flags(our, default=CliEnv())
3939
env_run_create_flags(our, mode="config")
4040

4141

tests/config/test_main.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,8 @@ def test_args_are_paths_when_with_change_dir(tox_project: ToxProjectCreator) ->
8888

8989
def test_relative_config_paths_resolve(tox_project: ToxProjectCreator) -> None:
9090
project = tox_project({"tox.ini": "[tox]"})
91-
result = project.run(
92-
"c",
93-
"-c",
94-
str(Path(project.path.name) / "tox.ini"),
95-
"-k",
96-
"change_dir",
97-
"env_dir",
98-
from_cwd=project.path.parent,
99-
)
91+
ini = str(Path(project.path.name) / "tox.ini")
92+
result = project.run("c", "-c", ini, "-k", "change_dir", "env_dir", from_cwd=project.path.parent)
10093
result.assert_success()
101-
expected = f"[testenv:py]\nchange_dir = {project.path}\nenv_dir = {project.path / '.tox' / 'py'}\n\n[tox]\n"
94+
expected = f"[testenv:py]\nchange_dir = {project.path}\nenv_dir = {project.path / '.tox' / 'py'}\n"
10295
assert result.out == expected

tests/session/cmd/test_show_config.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ def test_show_config_pkg_env_once(
129129
patch_prev_py: Callable[[bool], tuple[str, str]],
130130
) -> None:
131131
prev_ver, impl = patch_prev_py(True)
132-
project = tox_project(
133-
{"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""},
134-
)
135-
result = project.run("c")
132+
ini = f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel"
133+
project = tox_project({"tox.ini": ini, "pyproject.toml": ""})
134+
result = project.run("c", "-e", "ALL")
136135
result.assert_success()
137136
parser = ConfigParser(interpolation=None)
138137
parser.read_string(result.out)
@@ -145,10 +144,9 @@ def test_show_config_pkg_env_skip(
145144
patch_prev_py: Callable[[bool], tuple[str, str]],
146145
) -> None:
147146
prev_ver, impl = patch_prev_py(False)
148-
project = tox_project(
149-
{"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""},
150-
)
151-
result = project.run("c")
147+
ini = f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel"
148+
project = tox_project({"tox.ini": ini, "pyproject.toml": ""})
149+
result = project.run("c", "-e", "ALL")
152150
result.assert_success()
153151
parser = ConfigParser(interpolation=None)
154152
parser.read_string(result.out)

tests/tox_env/test_tox_env_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_tox_env_pass_env_fails_on_whitespace(tox_project: ToxProjectCreator) ->
8787
result.assert_success()
8888
msg = (
8989
'[testenv:py]\npass_env = # Exception: Fail("pass_env values cannot contain whitespace, use comma to have '
90-
f'multiple values in a single line, invalid values found {first!r}, {second!r}")\n\n[tox]\n'
90+
f'multiple values in a single line, invalid values found {first!r}, {second!r}")\n'
9191
)
9292
assert result.out == msg
9393

0 commit comments

Comments
 (0)