测试API

在 1.6 版本加入.

测试的实用函数和pytests设施在 sphinx.testing 中提供。如果您是Sphinx扩展的开发人员,您可以使用 pytest 编写单元测试。

pytest 配置

要使用 sphinx.testing 提供的 pytest 夹具,请将 'sphinx.testing.fixtures' 插件添加到您的测试模块或 conftest.py 文件中,如下所示:

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

如何使用

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