Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial revert of e4d0d600, fixing #1777 #1794

Merged
merged 2 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/1777.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression that broke using install_command in config replacements - by :user:`jayvdb`
6 changes: 6 additions & 0 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,12 @@ def _replace_match(self, match):
return os.pathsep

default_value = g["default_value"]
# special case: opts and packages. Leave {opts} and
# {packages} intact, they are replaced manually in
# _venv.VirtualEnv.run_install_command.
if sub_value in ("opts", "packages"):
return "{{{}}}".format(sub_value)

if sub_value == "posargs":
return self.reader.getposargs(default_value)

Expand Down
20 changes: 20 additions & 0 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,26 @@ def test_install_command_substitutions(self, newconfig):
]
assert envconfig.install_command == expected_deps

def test_install_command_substitutions_other_section(self, newconfig):
config = newconfig(
"""
[base]
install_command=some_install --arg={toxinidir}/foo \
{envname} {opts} {packages}
[testenv]
install_command={[base]install_command}
""",
)
envconfig = config.envconfigs["python"]
expected_deps = [
"some_install",
"--arg={}/foo".format(config.toxinidir),
"python",
"{opts}",
"{packages}",
]
assert envconfig.install_command == expected_deps

def test_pip_pre(self, newconfig):
config = newconfig(
"""
Expand Down