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
Indicate non-pytest warnings in the UI #1262
Comments
I agree test frameworks should make python warnings apparent in some way. I use this for my own testsuite: @pytest.yield_fixture(autouse=True)
def fail_tests_on_warnings():
warnings.simplefilter('error')
# https://github.com/pytest-dev/pytest-bdd/issues/153
warnings.filterwarnings('ignore', message=r'inspect.getargspec\(\) is '
r'deprecated, use inspect.signature\(\) instead',
category=DeprecationWarning)
yield
warnings.resetwarnings() Of course that'd be a bit harsh as a default, but maybe something like showing the warnings in the summary (and coloring it yellow), and printing the warnings if |
We would also probably need a way to silence some warnings, probably using some configuration variable. |
@bobsilverberg I think this relates to your recent question about showing warnings during a test run. |
@davehunt Yes this seems to. @The-Compiler I tried your code but I am still not seeing warnings anywhere. Could this relate to the fact that I am issuing the warning from inside a fixture? It seems that no matter what I do I cannot get the warning to appear anywhere. |
@bobsilverberg Hm, that's a good point, this can run after other fixtures. Can you try adding Probably it'd be cleaner to do this in a |
@fschulze created https://pypi.python.org/pypi/pytest-warnings it will move to core afer some more incubation closing this issue as solved by a plugin, please reopen in case of disagreement |
My library, Hypothesis potentially emits a number of warnings indicating that a test is in some way doing the wrong thing.
Currently these will only show up if the code is being run with --capture=no, or if a test actually fails. It would be useful if the user were in some way notified that their code is emitting warnings even within a passing test, because warnings might indicate that the test is passing erroneously.
Things I would ideally like to see:
I leave the exact UI up to your judgement, I just want the warnings my library is emitting to not get swallowed. :-)
The text was updated successfully, but these errors were encountered: