Skip to content

--log-cli-level also increases verbosity level #13612

@lor1113

Description

@lor1113

Simple example:

Image

with --log-cli-level:

Image

which incidentally happens to be the same as what you see with -v

Image

I don't have any fixtures that modify logging settings or caplog or anything like that, nor anything that actually reads the value of --log-cli-level in my code, so I'm pretty sure this is a pytest issue.

I am not sure if this is intentional or not, I am leaning towards unintentional (hence why I am filing as a bug report) because there's no mention of this behaviour I can find in the documentation. If it is intentional, I struggle to understand why, I can't see a good reason to tie these two things together, clearly you can want to immediately log critical messages while still otherwise having a compact output. If it is one of those things that is how it is because things are simply built that way and it's not practical to rework, then fair enough, maybe at most there could be a mention somewhere.

  • a detailed description of the bug or problem you are having
    see above
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • I spun up a new venv and confirmed this occurs identically with the only installed packages being the latest version of pytest and its dependencies. Observed on both WSL (Ubuntu 24.04.2 LTS) and Windows 11 Pro 24H2.
  • minimal example if possible
  • Works on the most minimal test possible: ie a single "test.py" file containing
def test_me():
    assert True is True

and using pytest test.py and pytest test.py --log-cli-level DEBUG

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions