diff --git a/changelog/12062.improvement.rst b/changelog/12062.improvement.rst new file mode 100644 index 00000000000..15dae027511 --- /dev/null +++ b/changelog/12062.improvement.rst @@ -0,0 +1 @@ +Clarified that :func:`pytest_assertrepr_compare <_pytest.hookspec.pytest_assertrepr_compare>` is also invoked for passing assertions when :confval:`enable_assertion_pass_hook` is enabled. diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 6c5dd4b7c4a..4751ade04c0 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -941,6 +941,9 @@ def pytest_assertrepr_compare( *in* a string will be escaped. Note that all but the first line will be indented slightly, the intention is for the first line to be a summary. + If the :confval:`enable_assertion_pass_hook` configuration option is enabled, + this hook is also called for passing assertions. + :param config: The pytest config object. :param op: The operator, e.g. `"=="`, `"!="`, `"not in"`. :param left: The left operand.