add documentation of register_assert_rewrite

wip
This commit is contained in:
Harry Percival 2018-09-25 06:49:50 +01:00 committed by GitHub
parent 4474beeb82
commit 2b762337bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -264,8 +264,12 @@ Advanced assertion introspection
Reporting details about a failing assertion is achieved by rewriting assert
statements before they are run. Rewritten assert statements put introspection
information into the assertion failure message. ``pytest`` only rewrites test
modules directly discovered by its test collection process, so asserts in
supporting modules which are not themselves test modules will not be rewritten.
modules directly discovered by its test collection process, so **asserts in
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.
.. note::