測試 API¶
在 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
檔案。