pytest-dev / pytest-dev/pytest
--log-cli-level also increases verbosity level
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Simple example:
with --log-cli-level:
which incidentally happens to be the same as what you see with -v
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 listfrom 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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