_pytest.assertion package¶
Submodules¶
Module contents¶
support for presenting detailed information in failing assertions.
-
register_assert_rewrite
(*names) → None[source]¶ Register one or more module names to be rewritten on import.
This function will make sure that this module or all modules inside the package will get their assert statements rewritten. Thus you should make sure to call this before the module is actually imported, usually in your __init__.py if you are a plugin using a package.
- Raises
TypeError – if the given module names are not strings.
-
for ... in
pytest_runtest_protocol
(item)[source]¶ Setup the pytest_assertrepr_compare and pytest_assertion_pass hooks
The newinterpret and rewrite modules will use util._reprcompare if it exists to use custom reporting via the pytest_assertrepr_compare hook. This sets up this custom comparison for the test.
-
pytest_assertrepr_compare
(config: _pytest.config.Config, op: str, left: Any, right: Any) → Optional[List[str]][source]¶