-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make sure all warnings in pytest get turned into errors #2838
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasons for CI being red:
conftest.py:19:RuntimeWarning: a __del__ method added to an existing type will not be called
on pypy3test_int_convert
did not warn on 3.10-dev
filterwarnings = | ||
# make warnings into errors but ignore certain third-party extension issues | ||
error | ||
# somehow, some DeprecationWarnings do not get turned into errors | ||
always::DeprecationWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why, oh why, does python try so hard to hide deprecation warnings?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have absolutely no clue. It gets funnier, btw: I added warnings.warn("abc", DeprecationWarning)
in a test and that did get turned into an error!
But I didn't feel like wasting even more time, and digging further than https://github.com/python/cpython/blob/3c8d6934436e20163be802f5239c5b4e4925eeec/Objects/longobject.c#L226
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, FutureWarning is (as clarified by PEP 565) the "user facing" deprecation warning.
Because got changed into So the deprecation period ended, but ... our tests don't fail because we still fall back to |
@@ -434,8 +434,7 @@ TEST_SUBMODULE(class_, m) { | |||
struct SamePointer {}; | |||
static SamePointer samePointer; | |||
py::class_<SamePointer, std::unique_ptr<SamePointer, py::nodelete>>(m, "SamePointer") | |||
.def(py::init([]() { return &samePointer; })) | |||
.def("__del__", [](SamePointer&) { py::print("__del__ called"); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this looks like a "sweep it under the carpet" kind of thing, you wouldn't be wrong. But we were never really using the fact that __del__
prints something anyway (possibly because it already didn't work on PyPy?).
9521405
to
c68411b
Compare
Just our own tests. This should be safe enough to merge :-) Thanks, @henryiii & @bstaletic! |
Description
Follow-up on #2837.
There's a weird thing going on where
filterwarnings=error
starts ignoring theDeprecationWarning
from https://github.com/python/cpython/blob/3c8d6934436e20163be802f5239c5b4e4925eeec/Objects/longobject.c#L226.I have no clue why. Apart from that, the
-Wa
flag seemed to take precedence, so no warning was actually an error.Suggested changelog entry:
None, just some tests.