Skip to content

tox does not expand {opts} {packages} from inside install_command #594

@ssbarnea

Description

@ssbarnea
[testenv]
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:/dev/null} {opts} {packages}

[testenv:foo]
commands =
   pip check
   {[testenv]install_command}
   pip check

This simplified example is supposed to test python environment for conflicts before and after installing the package but it fails with an exception like:

Invalid requirement: '{opts}'
Traceback (most recent call last):
File "/Users/ssbarnea/os/cinder/.tox/reqs/lib/python2.7/site-packages/pip/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/Users/ssbarnea/os/cinder/.tox/reqs/lib/python2.7/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
InvalidRequirement: Invalid requirement, parse error at "'{opts}'"

The current workaround is not to use expansion, duplicate the code and lose the ability to use {opts} and {packages}.

Please note that is impossible to use install_command on this environment because we need to run some commands before we install the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configurationhelp:wantedIssues that have been acknowledged, a solution determined and a PR might likely be accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions