Merge pull request #4032 from hjwp/patch-1
add documentation of register_assert_rewrite
This commit is contained in:
commit
b1fbb2ab92
|
@ -264,8 +264,12 @@ Advanced assertion introspection
|
||||||
Reporting details about a failing assertion is achieved by rewriting assert
|
Reporting details about a failing assertion is achieved by rewriting assert
|
||||||
statements before they are run. Rewritten assert statements put introspection
|
statements before they are run. Rewritten assert statements put introspection
|
||||||
information into the assertion failure message. ``pytest`` only rewrites test
|
information into the assertion failure message. ``pytest`` only rewrites test
|
||||||
modules directly discovered by its test collection process, so asserts in
|
modules directly discovered by its test collection process, so **asserts in
|
||||||
supporting modules which are not themselves test modules will not be rewritten.
|
supporting modules which are not themselves test modules will not be rewritten**.
|
||||||
|
|
||||||
|
You can manually enable assertion rewriting for an imported module by calling
|
||||||
|
`register_assert_rewrite <https://docs.pytest.org/en/latest/writing_plugins.html#assertion-rewriting>`_
|
||||||
|
before you import it (a good place to do that is in ``conftest.py``).
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue