diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2017-05-03 19:04:53 -0300 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2017-05-03 19:04:53 -0300 |
commit | f3b359f5b88946f8ff65e3a5e5cea2cfacce59e6 (patch) | |
tree | a8c519bff1ce4f43d82f7377df9233b28ec6db05 /doc/en/assert.rst | |
parent | cccb2cc92ba56033ef21c8627bb00debd6575aef (diff) | |
parent | 3fc917a261c6209080a34d0cf933305828a70d04 (diff) | |
download | pytest-f3b359f5b88946f8ff65e3a5e5cea2cfacce59e6.tar.gz |
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
# _pytest/capture.py
# _pytest/compat.py
# _pytest/python.py
# testing/python/collect.py
# testing/test_mark.py
Diffstat (limited to 'doc/en/assert.rst')
-rw-r--r-- | doc/en/assert.rst | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/doc/en/assert.rst b/doc/en/assert.rst index ba078c4c4..26090247c 100644 --- a/doc/en/assert.rst +++ b/doc/en/assert.rst @@ -270,12 +270,21 @@ supporting modules which are not themselves test modules will not be rewritten. .. note:: - ``pytest`` rewrites test modules on import. It does this by using an import - hook to write new pyc files. Most of the time this works transparently. + ``pytest`` rewrites test modules on import by using an import + hook to write new ``pyc`` files. Most of the time this works transparently. However, if you are messing with import yourself, the import hook may - interfere. If this is the case, use ``--assert=plain``. Additionally, - rewriting will fail silently if it cannot write new pycs, i.e. in a read-only - filesystem or a zipfile. + interfere. + + If this is the case you have two options: + + * Disable rewriting for a specific module by adding the string + ``PYTEST_DONT_REWRITE`` to its docstring. + + * Disable rewriting for all modules by using ``--assert=plain``. + + Additionally, rewriting will fail silently if it cannot write new ``.pyc`` files, + i.e. in a read-only filesystem or a zipfile. + For further information, Benjamin Peterson wrote up `Behind the scenes of pytest's new assertion rewriting <http://pybites.blogspot.com/2011/07/behind-scenes-of-pytests-new-assertion.html>`_. |