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. :-)
I agree test frameworks should make python warnings apparent in some way.
I use this for my own testsuite:
warnings.filterwarnings('ignore', message=r'inspect.getargspec\(\) is '
r'deprecated, use inspect.signature\(\) instead',
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 -v was used would help.
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 scope='module' to the yield_fixture decorator?
Probably it'd be cleaner to do this in a pytest_configure hook or so.
@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