File: testing.rst

package info (click to toggle)
sphinx 8.2.3-12
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid
  • size: 26,960 kB
  • sloc: python: 105,864; javascript: 6,474; perl: 449; makefile: 178; sh: 37; xml: 19; ansic: 2
file content (32 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Testing API
===========

.. py:module:: sphinx.testing
   :synopsis: Utility functions and pytest fixtures for testing.

.. versionadded:: 1.6

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_.

.. _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

   pytest_plugins = ('sphinx.testing.fixtures',)

Usage
-----

If you want to know more detailed usage,
please refer to :file:`tests/conftest.py` and other :file:`test_*.py` files
under the :file:`tests/` directory.