Since #2908, the user doesn't need to set warning filters to capture `DeprecationWarning` with `pytest.warns`. Fix #8666