Make sure all warnings in pytest get turned into errors#2838
Make sure all warnings in pytest get turned into errors#2838YannickJadoul merged 4 commits intopybind:masterfrom
Conversation
| # 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.
Why, oh why, does python try so hard to hide deprecation warnings?!
There was a problem hiding this comment.
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.
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 |
| 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.
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=errorstarts ignoring theDeprecationWarningfrom https://github.com/python/cpython/blob/3c8d6934436e20163be802f5239c5b4e4925eeec/Objects/longobject.c#L226.I have no clue why. Apart from that, the
-Waflag seemed to take precedence, so no warning was actually an error.Suggested changelog entry:
None, just some tests.