Description
Currently when a pytest warning appears, the users only see a notification like below
================= 1 pytest-warnings, 4 error in 0.12 seconds ==================
(do not confuse this one with the python warnings mechanism).
This happens when, for example, there's a pytest hook which relies on the __multicall__
.
If one wants to see what causes the warning, an additional -r w
flag has to be added to the commandline, or a corresponding ini file option has to be set. Example warnings summary:
=========================== pytest-warning summary ============================ WI1 <path>/conftest.py:92 'pytest_runtest_call' hook uses deprecated __multicall__ argument ================= 1 pytest-warnings, 4 error in 0.06 seconds ==================
It was agreed that the warnings summary should be displayed by default.
What would be the way to go now?
- We could set the
-r
flag to takew
as a default. However, the default value is overwritten when specifying-r XYZ
- or whatever else is then on the actual commandline call. The commandline flag will be taken instead of the default. Not an option, I guess, since many users already use the-r
flag. The notification wouldn't simply go through. - Modify the body of the
getreportopt()
function in the_pytest.terminal
and append thereportchars
variable withw
permanently. The question is here: how would then users silence the warnings if the wish to? Another flag, something like--set-report-chars
could be introduced which would override the-r
, but the plan is to limit the number of commandline options. Limiting the commandline options idea contradicts to adding a--disable-pytest-warnings
flag.
Would this pull request allow overriding the appended of the w
if option 2 is selected?
Or maybe you have a better idea how to enable the pytest warnings summary in another way?
Keep in mind that users should be still able to silence them.