Skip to content

Commit

Permalink
fix(parser): Fix --discover parsed incorrectly from env
Browse files Browse the repository at this point in the history
The flag was missing the type specification (`of_type`) and thus
parse.get_env_var did not execute the branch for list, but rather for
single variables.
The fallback in Converter lead to a call to `list("abc")`, which
resulted int a list of characters (["a", "b", "c"]).
  • Loading branch information
mimre25 committed Apr 26, 2024
1 parent 822c9d0 commit f71452d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/tox/config/cli/parser.py
Expand Up @@ -232,6 +232,7 @@ def __call__(
dest="discover",
nargs="+",
metavar="path",
of_type=list[str],
help="for Python discovery first try the Python executables under these paths",
default=[],
)
Expand Down
3 changes: 2 additions & 1 deletion tests/config/cli/test_cli_env_var.py
Expand Up @@ -84,6 +84,7 @@ def test_env_var_exhaustive_parallel_values(
monkeypatch.setenv("TOX_PARALLEL", "3")
monkeypatch.setenv("TOX_PARALLEL_LIVE", "no")
monkeypatch.setenv("TOX_OVERRIDE", "a=b;c=d")
monkeypatch.setenv("TOX_DISCOVER", "/foo/bar;/bar/baz;/baz/foo")

options = get_options()
assert vars(options.parsed) == {
Expand All @@ -93,7 +94,7 @@ def test_env_var_exhaustive_parallel_values(
"default_runner": "virtualenv",
"develop": False,
"devenv_path": None,
"discover": [],
"discover": ["/foo/bar", "/bar/baz", "/baz/foo"],
"env": CliEnv(["py37", "py36"]),
"force_dep": [],
"hash_seed": ANY,
Expand Down

0 comments on commit f71452d

Please sign in to comment.