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

cov-config file argument ignored when tox.ini exists #615

Open
schivmeister opened this issue Oct 19, 2023 · 1 comment
Open

cov-config file argument ignored when tox.ini exists #615

schivmeister opened this issue Oct 19, 2023 · 1 comment

Comments

@schivmeister
Copy link

Summary

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.

Reproducer

Versions

Windows 11 Pro 22H2
Python 3.8.18 (Anaconda)

pip list

pytest                        7.4.2
pytest-cov                    4.1.0

Config

tox.ini (w/ empty pytest section)

[tox]
skipsdist = true
envlist = py38

[testenv]
passenv = *
deps =
    -rrequirements.txt
commands =
    python -m pytest

[pytest]

setup.cfg (w/ additional pytest-cov config/opts)

[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.

@javiersrf
Copy link

I got the same problem but using --cov-config=setup.cfg. Still using the values of .coveragerc 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants