Skip to content

install_command only accepts a single command, but the documentation says that I can “provide arbitrary commands” to it #2433

Closed
@oakkitten

Description

@oakkitten

The documentation for install_command says,

Note: You can also provide arbitrary commands to the install_command. (...)

I don't think this is correct. Given this config,

[tox]
skip_install = true
skipsdist = true
envlist = foo

[testenv]
install_command =
    echo '!!!!!!!!!!!!!!!!!!!!!!! install 1' {packages}
    echo '!!!!!!!!!!!!!!!!!!!!!!! install 2' {packages}
commands =
    echo '!!!!!!!!!!!!!!!!!!!!!!! test' {envname}
allowlist_externals =
    echo
deps =
    zoo

tox 3 will only execute the first command:

$ python -m tox -rvv
...
[1190] /mnt/c/Users/s/tox_install_command_test$ /usr/bin/echo '!!!!!!!!!!!!!!!!!!!!!!! install 1' zoo
!!!!!!!!!!!!!!!!!!!!!!! install 1 zoo
foo finish: getenv /mnt/c/Users/s/tox_install_command_test/.tox/foo after 17.95 seconds
...

and tox 4 will execute what appears to be the two commands glued together as one, but only replacing the first {packages}

$ python -m tox -rvv
...
foo: 20300 W install_deps> echo '!!!!!!!!!!!!!!!!!!!!!!! install 1' zoo echo '!!!!!!!!!!!!!!!!!!!!!!! install 2' '{packages}' [tox/tox_env/api.py:398]
!!!!!!!!!!!!!!!!!!!!!!! install 1 zoo echo !!!!!!!!!!!!!!!!!!!!!!! install 2 {packages}
foo: 20324 I exit 0 (0.01 seconds) /mnt/c/Users/s/tox_install_command_test> echo '!!!!!!!!!!!!!!!!!!!!!!! install 1' zoo echo '!!!!!!!!!!!!!!!!!!!!!!! install 2' '{packages}' pid=1269 [tox/execute/api.py:275]
...

I suppose that tox should:

  • Change the documentation so that it doesn't say that I can use command“s” in install_command;
  • Produce an error if I try, instead of ignoring lines or gluing them together.

Also, tox might:

  • Support multiple installation commands via install_commands (note the ”s”), and only require {packages} to be passed to one of them;
  • Deprecate install_command in favor of the above.

See logs: tox3.txt, tox4.txt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions