When supplying --cov-config=$file (where $file is e.g. setup.cfg) in the presence of a tox.ini with a [pytest] section, pytest/coverage will continue to pick up configuration from tox.ini.
Expected vs actual result
Expected: Configuration from $file is picked up because an override argument has been supplied.
Actual: The --cov-config argument is being ignored when there is a valid tox.ini with a [pytest] section.
[tool:pytest]
addopts =
--cov-report=xml
-r a
-q
-v
--gherkin-terminal-reporter
--log-level=DEBUG
Code
Above config files are the MWE. The test output will not contain the XML file from the configuration in $file (e.g. setup.cfg) because the tox.ini file is prioritized, which has an empty [pytest] section.
Summary
When supplying
--cov-config=$file
(where$file
is e.g.setup.cfg
) in the presence of atox.ini
with a[pytest]
section, pytest/coverage will continue to pick up configuration fromtox.ini
.Expected vs actual result
Expected: Configuration from
$file
is picked up because an override argument has been supplied. Actual: The--cov-config
argument is being ignored when there is a validtox.ini
with a[pytest]
section.Reproducer
Versions
Windows 11 Pro 22H2 Python 3.8.18 (Anaconda)
pip list
Config
tox.ini (w/ empty
pytest
section)setup.cfg (w/ additional pytest-cov config/opts)
Code
Above config files are the MWE. The test output will not contain the XML file from the configuration in
$file
(e.g.setup.cfg
) because thetox.ini
file is prioritized, which has an empty[pytest]
section.