Description
Issue
I'm creating a pipeline where a coverage report is generated over multiple test runs (spanning different Python versions). To do this, I want to include the tox environment in the coverage file name, so the artifacts don't overwrite each other in the pipeline job that combines the coverage files.
It's configured as follows (with some sections left out):
[testenv]
package = wheel
deps =
coverage[toml] ~= 7.0
commands_pre =
python -m coverage erase
commands =
python -m coverage run --data-file=.coverage.{env_name} --branch --source my.project -m unittest discover {posargs:tests/unit}
This worked fine up to tox 4.14.0:
py311: commands_pre[0]> python -m coverage erase
py311: commands[0]> python -m coverage run --data-file=.coverage.py311 --branch --source my.project -m unittest discover tests/unit
However, from tox 14.4.1 onwards, the env_name
variable isn't substituted anymore, and just comes through as {env_name}
py311: commands_pre[0]> python -m coverage erase
py311: commands[0]> python -m coverage run --data-file=.coverage.{env_name} --branch --source myproject -m unittest discover tests/unit
Environment
Provide at least:
- OS: Windows 10
Output of pip list
of the host Python, where tox
is installed
Package Version
------------- -------
cachetools 5.3.3
chardet 5.2.0
colorama 0.4.6
distlib 0.3.8
filelock 3.14.0
packaging 24.1
pip 24.0
platformdirs 4.2.2
pluggy 1.5.0
pyproject-api 1.6.1
setuptools 65.5.0
tomli 2.0.1
tox 4.14.1
virtualenv 20.26.2
Output of running tox
See above.
Minimal example
I tried to create a minimal example by creating a tox configuration that doesn't build and install a package, but for some reason the substitution in the command did work there. So somehow the package building and installing is important for the issue to occur.
Unfortunately, I can't share my entire tox config, as it's part of a corporate repo.