Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable warnings to notify the users about the deprecated features #1668

Closed
aostr opened this issue Jun 25, 2016 · 1 comment
Closed

enable warnings to notify the users about the deprecated features #1668

aostr opened this issue Jun 25, 2016 · 1 comment
Milestone

Comments

@aostr
Copy link

aostr commented Jun 25, 2016

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?

  1. We could set the -r flag to take w 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.
  2. Modify the body of the getreportopt() function in the _pytest.terminal and append the reportchars variable with w 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.

@aostr
Copy link
Author

aostr commented Jun 25, 2016

I spoke with @hpk42 and I will implement a new flag --disable-pytest-warnings.
In such case, when -r w --disable-pytest-warnings is called, the warnings are silenced. In other cases even if the w is not set on the -r flag, the warnings summary is going to be displayed.

@nicoddemus nicoddemus added this to the 3.0 milestone Jun 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants