-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Warnings handling #1996
Comments
there is the pytest-warnings plugin - it already shows the warnings at the end of a test the plan is to integrate it into a upcoming py.test feature release please take a look, we'd appreciate feedback on whether it works for you |
I just tried it, ran py.test with |
|
I'm pretty sure, yeah! https://pypi.python.org/pypi/pytest-warnings It says to run with |
Oh! Sorry, I didn't know that plugin repurposed the FWIW I use it with |
With |
Doing some more testing reveals that the plugin doesn't report warnings when combined with It does fulfill our needs perfectly! |
@fschulze any idea how i could debug that? |
I don't know how xdist works. We may be using the wrong hook in pytest-warnings. I have never used xdist myself yet. |
https://github.com/pytest-dev/pytest-xdist/blob/master/xdist/plugin.py Doesn't look like there is a clash between the hooks used... |
@fschulze i believe warnings are not transferred between different interpreter processes |
Looks like you're right. Should I go and complain over there? :) |
superseeded by the xdist issue, thanks for bringing it to attention again |
Let's say that we have the following piece of code under test:
This test will pass, and no warning will be visible in pytest's output because stdout is suppressed when a test passes.
Now we change the function under test:
The test will still pass, and the newly introduced deprecationwarning will be hidden from pytest's output.
I now have to run
py.test
with the-s
argument to make sure I don't miss these things, but this also shows the UserWarning that I am asserting, which is messing up pytest's output!There are two ways to resolve, in my humble opinion:
pytest.warns
pytest.warns
Is there already a way (or a plugin) to configure pytest as desired? Or does it require new development effort? Would like to hear your thoughts on the matter. Thanks for your time. :)
The text was updated successfully, but these errors were encountered: