测试API

Added in version 1.6.

中提供了用于测试的实用功能和pytest固定装置 sphinx.testing .如果您是Sphinx扩展的开发人员,您可以使用以下语言编写单元测试 pytest.

pytest 配置

使用由提供的pytest固定装置 sphinx.testing ,添加 'sphinx.testing.fixtures' 插件到您的测试模块或 conftest.py 文件如下:

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

使用

如果您想了解更详细的使用方法,请参阅 tests/conftest.py 和其他 test_*.py 下的文件 tests/ 目录.