Skip to content

Commit b1fbb2a

Browse files
authored
Merge pull request #4032 from hjwp/patch-1
add documentation of register_assert_rewrite
2 parents e85edf5 + b03bad5 commit b1fbb2a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/en/assert.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,12 @@ Advanced assertion introspection
264264
Reporting details about a failing assertion is achieved by rewriting assert
265265
statements before they are run. Rewritten assert statements put introspection
266266
information into the assertion failure message. ``pytest`` only rewrites test
267-
modules directly discovered by its test collection process, so asserts in
268-
supporting modules which are not themselves test modules will not be rewritten.
267+
modules directly discovered by its test collection process, so **asserts in
268+
supporting modules which are not themselves test modules will not be rewritten**.
269+
270+
You can manually enable assertion rewriting for an imported module by calling
271+
`register_assert_rewrite <https://docs.pytest.org/en/latest/writing_plugins.html#assertion-rewriting>`_
272+
before you import it (a good place to do that is in ``conftest.py``).
269273

270274
.. note::
271275

0 commit comments

Comments
 (0)