pytest-dev / pytest-dev/pytest

--log-cli-level also increases verbosity level

Open
#13,612 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: logging
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal test.py example and compare pytest test.py, pytest test.py --log-cli-level DEBUG, and pytest test.py -v. Trace the CLI handling for logging level and verbosity, then add a regression test showing that --log-cli-level does not change normal verbosity; done means the two settings act independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.