MCPcopy Create free account
hub / github.com/pytest-dev/pytest / pytest_assertion_pass

Function pytest_assertion_pass

src/_pytest/hookspec.py:643–668  ·  view source on GitHub ↗

Called whenever an assertion passes. .. versionadded:: 5.0 Use this hook to do some processing after a passing assertion. The original assertion information is available in the `orig` string and the pytest introspected assertion information is available in the `expl` string.

(item: "Item", lineno: int, orig: str, expl: str)

Source from the content-addressed store, hash-verified

641
642
643def pytest_assertion_pass(item: "Item", lineno: int, orig: str, expl: str) -> None:
644 """Called whenever an assertion passes.
645
646 .. versionadded:: 5.0
647
648 Use this hook to do some processing after a passing assertion.
649 The original assertion information is available in the `orig` string
650 and the pytest introspected assertion information is available in the
651 `expl` string.
652
653 This hook must be explicitly enabled by the ``enable_assertion_pass_hook``
654 ini-file option:
655
656 .. code-block:: ini
657
658 [pytest]
659 enable_assertion_pass_hook=true
660
661 You need to **clean the .pyc** files in your project directory and interpreter libraries
662 when enabling this option, as assertions will require to be re-written.
663
664 :param pytest.Item item: pytest item object of current test.
665 :param int lineno: Line number of the assert statement.
666 :param str orig: String with the original assertion.
667 :param str expl: String with the assert explanation.
668 """
669
670
671# -------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected