From 8b7e6df73d67953e949cf5605954d9c43a0fd5f7 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 1 Mar 2018 17:54:54 -0300 Subject: [PATCH] Add register_assert_rewrite and improve signature of other functions --- doc/en/reference.rst | 23 +++++++++++++++-------- doc/en/writing_plugins.rst | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 70cda3b84..b30d02052 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -29,7 +29,7 @@ pytest.fail pytest.skip ~~~~~~~~~~~ -.. autofunction:: _pytest.outcomes.skip +.. autofunction:: _pytest.outcomes.skip(msg, [allow_module_level=False]) pytest.importorskip ~~~~~~~~~~~~~~~~~~~ @@ -42,26 +42,26 @@ pytest.xfail .. autofunction:: _pytest.outcomes.xfail pytest.exit -~~~~~~~~~~~ +----------- .. autofunction:: _pytest.outcomes.exit pytest.main -~~~~~~~~~~~ +----------- .. autofunction:: _pytest.config.main pytest.param -~~~~~~~~~~~~ +------------ -.. autofunction:: _pytest.mark.param +.. autofunction:: pytest.param(*values, [id], [marks]) pytest.raises ------------- **Tutorial**: :ref:`assertraises`. -.. autofunction:: _pytest.python_api.raises +.. autofunction:: pytest.raises(expected_exception: Exception, [match], [message]) :with: excinfo pytest.deprecated_call @@ -69,15 +69,22 @@ pytest.deprecated_call **Tutorial**: :ref:`ensuring_function_triggers`. -.. autofunction:: _pytest.recwarn.deprecated_call +.. autofunction:: pytest.deprecated_call() :with: +pytest.register_assert_rewrite +------------------------------ + +**Tutorial**: :ref:`assertion-rewriting`. + +.. autofunction:: pytest.register_assert_rewrite + pytest.warns ------------ **Tutorial**: :ref:`assertwarnings` -.. autofunction:: _pytest.recwarn.warns +.. autofunction:: pytest.warns(expected_warning: Exception, [match]) :with: Marks diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 55f692a6a..33a362a8a 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -176,6 +176,8 @@ If a package is installed this way, ``pytest`` will load to make it easy for users to find your plugin. +.. _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. .. autofunction:: pytest.register_assert_rewrite + :noindex: This is especially important when you write a pytest plugin which is created using a package. The import hook only treats ``conftest.py``