Add register_assert_rewrite and improve signature of other functions

This commit is contained in:
Bruno Oliveira 2018-03-01 17:54:54 -03:00
parent 9c2203d381
commit 8b7e6df73d
2 changed files with 18 additions and 8 deletions

View File

@ -29,7 +29,7 @@ pytest.fail
pytest.skip pytest.skip
~~~~~~~~~~~ ~~~~~~~~~~~
.. autofunction:: _pytest.outcomes.skip .. autofunction:: _pytest.outcomes.skip(msg, [allow_module_level=False])
pytest.importorskip pytest.importorskip
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
@ -42,26 +42,26 @@ pytest.xfail
.. autofunction:: _pytest.outcomes.xfail .. autofunction:: _pytest.outcomes.xfail
pytest.exit pytest.exit
~~~~~~~~~~~ -----------
.. autofunction:: _pytest.outcomes.exit .. autofunction:: _pytest.outcomes.exit
pytest.main pytest.main
~~~~~~~~~~~ -----------
.. autofunction:: _pytest.config.main .. autofunction:: _pytest.config.main
pytest.param pytest.param
~~~~~~~~~~~~ ------------
.. autofunction:: _pytest.mark.param .. autofunction:: pytest.param(*values, [id], [marks])
pytest.raises pytest.raises
------------- -------------
**Tutorial**: :ref:`assertraises`. **Tutorial**: :ref:`assertraises`.
.. autofunction:: _pytest.python_api.raises .. autofunction:: pytest.raises(expected_exception: Exception, [match], [message])
:with: excinfo :with: excinfo
pytest.deprecated_call pytest.deprecated_call
@ -69,15 +69,22 @@ pytest.deprecated_call
**Tutorial**: :ref:`ensuring_function_triggers`. **Tutorial**: :ref:`ensuring_function_triggers`.
.. autofunction:: _pytest.recwarn.deprecated_call .. autofunction:: pytest.deprecated_call()
:with: :with:
pytest.register_assert_rewrite
------------------------------
**Tutorial**: :ref:`assertion-rewriting`.
.. autofunction:: pytest.register_assert_rewrite
pytest.warns pytest.warns
------------ ------------
**Tutorial**: :ref:`assertwarnings` **Tutorial**: :ref:`assertwarnings`
.. autofunction:: _pytest.recwarn.warns .. autofunction:: pytest.warns(expected_warning: Exception, [match])
:with: :with:
Marks Marks

View File

@ -176,6 +176,8 @@ If a package is installed this way, ``pytest`` will load
to make it easy for users to find your plugin. to make it easy for users to find your plugin.
.. _assertion-rewriting:
Assertion Rewriting Assertion Rewriting
------------------- -------------------
@ -196,6 +198,7 @@ assertion rewriting to be enabled you need to ask ``pytest``
explicitly to rewrite this module before it gets imported. explicitly to rewrite this module before it gets imported.
.. autofunction:: pytest.register_assert_rewrite .. autofunction:: pytest.register_assert_rewrite
:noindex:
This is especially important when you write a pytest plugin which is This is especially important when you write a pytest plugin which is
created using a package. The import hook only treats ``conftest.py`` created using a package. The import hook only treats ``conftest.py``