Add tutorial links to all references

This commit is contained in:
Bruno Oliveira 2018-02-27 17:58:51 -03:00
parent 215c6b281e
commit 66009b0f91
3 changed files with 27 additions and 2 deletions

View File

@ -3,6 +3,8 @@
Basic patterns and examples Basic patterns and examples
========================================================== ==========================================================
.. _request example:
Pass different values to a test function, depending on command line options Pass different values to a test function, depending on command line options
---------------------------------------------------------------------------- ----------------------------------------------------------------------------

View File

@ -54,14 +54,16 @@ pytest.main
pytest.raises pytest.raises
------------- -------------
**Tutorial**: :ref:`assertraises`.
.. autofunction:: _pytest.python_api.raises .. autofunction:: _pytest.python_api.raises
:with: excinfo :with: excinfo
Examples at :ref:`assertraises`.
pytest.deprecated_call pytest.deprecated_call
---------------------- ----------------------
**Tutorial**: :ref:`ensuring_function_triggers`.
.. autofunction:: _pytest.recwarn.deprecated_call .. autofunction:: _pytest.recwarn.deprecated_call
:with: :with:
@ -70,6 +72,7 @@ pytest.deprecated_call
Hooks Hooks
----- -----
**Tutorial**: :doc:`writing_plugins`.
.. currentmodule:: _pytest.hookspec .. currentmodule:: _pytest.hookspec
@ -265,6 +268,8 @@ Full reference to objects accessible from :ref:`fixtures <fixture>` or hooks
Fixtures Fixtures
-------- --------
**Tutorial**: :ref:`fixture`.
Fixtures are requested by test functions or other fixtures by declaring them as argument names. Fixtures are requested by test functions or other fixtures by declaring them as argument names.
@ -303,6 +308,8 @@ fixture decorator
config.cache config.cache
~~~~~~~~~~~~ ~~~~~~~~~~~~
**Tutorial**: :ref:`cache`.
The ``config.cache`` object allows other plugins and fixtures The ``config.cache`` object allows other plugins and fixtures
to store and retrieve values across test runs. To access it from fixtures to store and retrieve values across test runs. To access it from fixtures
request ``pytestconfig`` into your fixture and get it with ``pytestconfig.cache``. request ``pytestconfig`` into your fixture and get it with ``pytestconfig.cache``.
@ -320,6 +327,8 @@ Under the hood, the cache plugin uses the simple
capsys capsys
~~~~~~ ~~~~~~
**Tutorial**: :doc:`capture`.
.. currentmodule:: _pytest.capture .. currentmodule:: _pytest.capture
.. autofunction:: capsys() .. autofunction:: capsys()
@ -340,6 +349,8 @@ capsys
capsysbinary capsysbinary
~~~~~~~~~~~~ ~~~~~~~~~~~~
**Tutorial**: :doc:`capture`.
.. autofunction:: capsysbinary() .. autofunction:: capsysbinary()
:no-auto-options: :no-auto-options:
@ -358,6 +369,8 @@ capsysbinary
capfd capfd
~~~~~~ ~~~~~~
**Tutorial**: :doc:`capture`.
.. autofunction:: capfd() .. autofunction:: capfd()
:no-auto-options: :no-auto-options:
@ -376,6 +389,8 @@ capfd
capfdbinary capfdbinary
~~~~~~~~~~~~ ~~~~~~~~~~~~
**Tutorial**: :doc:`capture`.
.. autofunction:: capfdbinary() .. autofunction:: capfdbinary()
:no-auto-options: :no-auto-options:
@ -394,6 +409,8 @@ capfdbinary
doctest_namespace doctest_namespace
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
**Tutorial**: :doc:`doctest`.
.. autofunction:: _pytest.doctest.doctest_namespace() .. autofunction:: _pytest.doctest.doctest_namespace()
Usually this fixture is used in conjunction with another ``autouse`` fixture: Usually this fixture is used in conjunction with another ``autouse`` fixture:
@ -410,6 +427,8 @@ doctest_namespace
request request
~~~~~~~ ~~~~~~~
**Tutorial**: :ref:`request example`.
The ``request`` fixture is a special fixture providing information of the requesting test function. The ``request`` fixture is a special fixture providing information of the requesting test function.
.. autoclass:: _pytest.fixtures.FixtureRequest() .. autoclass:: _pytest.fixtures.FixtureRequest()
@ -425,6 +444,8 @@ pytestconfig
record_xml_property record_xml_property
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
**Tutorial**: :ref:`record_xml_property example`.
.. autofunction:: _pytest.junitxml.record_xml_property() .. autofunction:: _pytest.junitxml.record_xml_property()
caplog caplog

View File

@ -220,6 +220,8 @@ To set the name of the root test suite xml item, you can configure the ``junit_s
[pytest] [pytest]
junit_suite_name = my_suite junit_suite_name = my_suite
.. _record_xml_property example:
record_xml_property record_xml_property
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^