tox icon indicating copy to clipboard operation
tox copied to clipboard

tox4: Generative section names result in additional commands, not overridden commands

Open garrison opened this issue 3 years ago • 0 comments

I have noticed something that behaves differently on tox 4.0.0b1 compared with tox 3.24.5.

Consider the following tox.ini with generative section names:

[tox]
minversion = 3.15
envlist = py37, lint
skipsdist = true

[testenv]
usedevelop = true
install_command = pip install -U {opts} {packages}
deps = black
commands =
  pip freeze

[testenv:{black,lint}]
envdir = {toxworkdir}/lint
commands =
  black: black {posargs} .
  lint: black --check {posargs} .

When I run tox -elint (on version 3), this runs only the black --check line, as expected.

However, if I run tox4 -elint, it runs the pip freeze command under [testenv] before running black --check. Instead of overriding commands, I end up with all the commands.

This only seems to happen with the generative section names, i.e. when I change it to [testenv:lint], the behavior is as expected.

garrison avatar Feb 19 '22 03:02 garrison