summaryrefslogtreecommitdiff
path: root/src/tox
diff options
context:
space:
mode:
authorBernát Gábor <gaborjbernat@gmail.com>2023-01-02 11:58:01 -0800
committerGitHub <noreply@github.com>2023-01-02 11:58:01 -0800
commit997128ced47936adabb2f267d2606f8eac253ad3 (patch)
treeccf2e729d76c452d715a501b1e9d0d7c0f3af476 /src/tox
parentd202833481f891c19ad2b096ddc63eaee10383eb (diff)
downloadtox-git-997128ced47936adabb2f267d2606f8eac253ad3.tar.gz
Better message when command parsing on empty input (#2807)
Diffstat (limited to 'src/tox')
-rw-r--r--src/tox/config/loader/str_convert.py2
-rw-r--r--src/tox/tox_env/python/pip/pip_install.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/tox/config/loader/str_convert.py b/src/tox/config/loader/str_convert.py
index e31c034f..f07545f5 100644
--- a/src/tox/config/loader/str_convert.py
+++ b/src/tox/config/loader/str_convert.py
@@ -63,6 +63,8 @@ class StrConvert(Convert[str]):
pos = splitter.instream.tell()
except ValueError:
args.append(value[pos:])
+ if len(args) == 0:
+ raise ValueError(f"attempting to parse {value!r} into a command failed")
if args[0] != "-" and args[0].startswith("-"):
args[0] = args[0][1:]
args = ["-"] + args
diff --git a/src/tox/tox_env/python/pip/pip_install.py b/src/tox/tox_env/python/pip/pip_install.py
index a148ce32..2136e862 100644
--- a/src/tox/tox_env/python/pip/pip_install.py
+++ b/src/tox/tox_env/python/pip/pip_install.py
@@ -160,7 +160,10 @@ class Pip(Installer[Python]):
outcome.assert_success()
def build_install_cmd(self, args: Sequence[str]) -> list[str]:
- cmd: Command = self._env.conf["install_command"]
+ try:
+ cmd: Command = self._env.conf["install_command"]
+ except ValueError as exc:
+ raise Fail(f"unable to determine pip install command: {str(exc)}") from exc
install_command = cmd.args
try:
opts_at = install_command.index("{packages}")