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