sphinx/doc/extdev/testing.rst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
834 B
ReStructuredText
Raw Permalink Normal View History

2024-07-24 09:13:26 -05:00
Testing API
===========
.. py:module:: sphinx.testing
2024-07-24 09:13:26 -05:00
:synopsis: Utility functions and pytest fixtures for testing.
.. versionadded:: 1.6
2024-07-24 09:13:26 -05:00
Utility functions and pytest fixtures for testing
are provided in :py:mod:`!sphinx.testing`.
If you are a developer of Sphinx extensions,
you can write unit tests with pytest_.
2024-07-24 09:13:26 -05:00
.. _pytest: https://docs.pytest.org/en/latest/
``pytest`` configuration
-------------------------
To use pytest fixtures that are provided by ``sphinx.testing``,
add the ``'sphinx.testing.fixtures'`` plugin
to your test modules or :file:`conftest.py` files as follows:
.. code-block:: python
2024-07-24 09:13:26 -05:00
pytest_plugins = ('sphinx.testing.fixtures',)
Usage
-----
2024-07-24 09:13:26 -05:00
If you want to know more detailed usage,
please refer to :file:`tests/conftest.py` and other :file:`test_*.py` files
2024-07-24 09:13:26 -05:00
under the :file:`tests/` directory.