pytest-dev / pytest-django

A Django plugin for pytest.
https://pytest-django.readthedocs.io/
Other
1.33k stars 341 forks source link

Fix verbose configuration option value check #1060

Closed stephane closed 5 months ago

stephane commented 1 year ago

This commit corrects the check for the 'verbose' configuration option value. Previously, it was checked if the value was strictly greater than 0, but the use of '-v' flag sets the value to 0.

Edit: My original patch changed to verbose = config.getoption("verbose") >= 0 in fixtures.py.

stephane commented 1 year ago

May be the right fix is to change the message "(add -v option to show queries)" to "(add -v -v option to show queries)"

bluetech commented 8 months ago

but the use of '-v' flag sets the value to 0.

I may be confused but I'm pretty sure passing -v sets verbosity to 1, not 0. If so, then the current code is correct. Perhaps you are passing -q somewhere? A -q reduces the verbosity by 1, so -q -v ends up 0.

stephane commented 5 months ago

I didnt use other flags...

bluetech commented 5 months ago

Maybe it's in your pytest config or in PYTEST_ADDOPTS envvar.