pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

--cov as final emelent in addopts xcreates confusing behaviour

Open ego-thales opened this issue 4 months ago • 9 comments

Hi there,

I'm not sure this is a pytest bug but here it goes.

I have the following pyproject.toml configuration

[tool.pytest.ini_options]
testpaths = "test"
addopts = [
    "--import-mode=importlib",  # Recommended by pytest
    "--cov",
]

so I can easily use

pytest

to start my tests.

Now when I want to test only a specific file, doing

pytest specific/file.py

ignores the argument, while in the mean time, passing another optional argument such as the following

pytest -s specific/file.py

works perfectly as intended.

Am I missing a piece or is this a pytest-side problem?

Thanks in advance!

All the best. Élie

ego-thales avatar Jun 20 '25 14:06 ego-thales