Tests/test_features.py::test_check FAILED [ 2%]
================================== FAILURES ===================================
_________________________________ test_check __________________________________
def test_check() -> None:
# Check the correctness of the convenience function
for module in features.modules:
assert features.check_module(module) == features.check(module)
for codec in features.codecs:
assert features.check_codec(codec) == features.check(codec)
for feature in features.features:
if "webp" in feature:
> with pytest.warns(DeprecationWarning):
E Failed: DID NOT WARN. No warnings of type (<class 'DeprecationWarning'>,) were emitted.
E Emitted warnings: [].
The backstory of this is that #8213 deprecated features.check("transp_webp"), features.check("webp_mux") and features.check("webp_anim").
However, the deprecation warning is only raised if the underlying WebP module is installed, and the missing module doesn't raise an error earlier than the warning.
When I run the test suite without WebP installed, it fails.
The backstory of this is that #8213 deprecated
features.check("transp_webp")
,features.check("webp_mux")
andfeatures.check("webp_anim")
.However, the deprecation warning is only raised if the underlying WebP module is installed, and the missing module doesn't raise an error earlier than the warning.
https://github.com/python-pillow/Pillow/blob/e93dcc15780d29af45fa64cf54ff6b11c2c27c46/src/PIL/features.py#L149-L159
This PR updates features.py so that the feature checks raise a deprecation warning when WebP is not installed as well.