From f71452d62013c68d3c962ae4d734367c233ccd0b Mon Sep 17 00:00:00 2001 From: Martin Imre Date: Fri, 26 Apr 2024 13:39:46 +0200 Subject: [PATCH] fix(parser): Fix --discover parsed incorrectly from env 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"]). --- src/tox/config/cli/parser.py | 1 + tests/config/cli/test_cli_env_var.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tox/config/cli/parser.py b/src/tox/config/cli/parser.py index 7afe87753..24e06b5a7 100644 --- a/src/tox/config/cli/parser.py +++ b/src/tox/config/cli/parser.py @@ -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=[], ) diff --git a/tests/config/cli/test_cli_env_var.py b/tests/config/cli/test_cli_env_var.py index 3c870ae9e..7f265c78c 100644 --- a/tests/config/cli/test_cli_env_var.py +++ b/tests/config/cli/test_cli_env_var.py @@ -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) == { @@ -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,