测试 API¶
Added in version 1.6.
在 sphinx.testing 中提供了用于测试的实用函数和 pytest 固定装置.如果你是 Sphinx 扩展的开发者,你可以使用 pytest 编写单元测试.
pytest 配置¶
要使用 sphinx.testing 提供的 pytest 固定装置,请将 'sphinx.testing.fixtures' 插件添加到您的测试模块或 conftest.py 文件中,如下所示:
pytest_plugins = ('sphinx.testing.fixtures',)
用法¶
如果你想了解更多详细用法,请参考 tests/conftest.py 以及 tests/ 目录下的其他 test_*.py 文件.