| 1 |
Testing API |
| 2 |
=========== |
| 3 |
|
| 4 |
.. py:module:: sphinx.testing |
| 5 |
:synopsis: Utility functions and pytest fixtures for testing. |
| 6 |
|
| 7 |
.. versionadded:: 1.6 |
| 8 |
|
| 9 |
Utility functions and pytest fixtures for testing |
| 10 |
are provided in :py:mod:`!sphinx.testing`. |
| 11 |
If you are a developer of Sphinx extensions, |
| 12 |
you can write unit tests with pytest_. |
| 13 |
|
| 14 |
.. _pytest: https://docs.pytest.org/en/latest/ |
| 15 |
|
| 16 |
``pytest`` configuration |
| 17 |
------------------------- |
| 18 |
|
| 19 |
To use pytest fixtures that are provided by ``sphinx.testing``, |
| 20 |
add the ``'sphinx.testing.fixtures'`` plugin |
| 21 |
to your test modules or :file:`conftest.py` files as follows: |
| 22 |
|
| 23 |
.. code-block:: python |
| 24 |
|
| 25 |
pytest_plugins = ('sphinx.testing.fixtures',) |
| 26 |
|
| 27 |
Usage |
| 28 |
----- |
| 29 |
|
| 30 |
If you want to know more detailed usage, |
| 31 |
please refer to :file:`tests/conftest.py` and other :file:`test_*.py` files |
| 32 |
under the :file:`tests/` directory. |