From c54dfbd9ad4aad9f0ef5503b7dff2558cdf64208 Mon Sep 17 00:00:00 2001 From: Martin Imre Date: Fri, 26 Apr 2024 20:56:23 +0200 Subject: [PATCH] fix(parser): Fix --discover parsed incorrectly from env (#3274) --- docs/changelog/3272.bugfix.rst | 1 + docs/changelog/3274.doc.rst | 1 + src/tox/config/cli/parser.py | 3 ++- tests/config/cli/test_cli_env_var.py | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 docs/changelog/3272.bugfix.rst create mode 100644 docs/changelog/3274.doc.rst diff --git a/docs/changelog/3272.bugfix.rst b/docs/changelog/3272.bugfix.rst new file mode 100644 index 000000000..7877bd400 --- /dev/null +++ b/docs/changelog/3272.bugfix.rst @@ -0,0 +1 @@ +Fix broken input parsing for ``--discover`` flag. - by :user:`mimre25` diff --git a/docs/changelog/3274.doc.rst b/docs/changelog/3274.doc.rst new file mode 100644 index 000000000..d2ffe6028 --- /dev/null +++ b/docs/changelog/3274.doc.rst @@ -0,0 +1 @@ +Rephrase ``--discover`` flag's description to avoid confusion between paths and executables. - by :user:`mimre25` diff --git a/src/tox/config/cli/parser.py b/src/tox/config/cli/parser.py index 7afe87753..707c7fc8a 100644 --- a/src/tox/config/cli/parser.py +++ b/src/tox/config/cli/parser.py @@ -232,7 +232,8 @@ def __call__( dest="discover", nargs="+", metavar="path", - help="for Python discovery first try the Python executables under these paths", + of_type=List[str], + help="for Python discovery first try these Python executables", default=[], ) list_deps = sub_parser.add_mutually_exclusive_group() 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,