Overview

pytest 7.4, released on December 8, 2023, improves warning handling and test report readability.

Main Features

Warning filters are more granular and the end-of-session summary displays warnings in a more structured way.

python
import pytest

def test_warning():
    with pytest.warns(DeprecationWarning):
        import warnings
        warnings.warn('old API', DeprecationWarning)

# pytest -W error::DeprecationWarning

Sources