Skip to content

--cov as final element in addopts creates confusing behaviour #701

@ego-thales

Description

@ego-thales

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions