【发布时间】:2019-04-10 06:21:41
【问题描述】:
我根据 ToDo 示例在 pytest 中为 Sphinx 文档创建了自己的扩展。 这是从每个 pytest test_function 的每个文档字符串中读取和收集“test_summary”。
def test_sphinx():
"""
This is the first sentence in the test_sphinx test case.
.. test_summary:: This is the test summary one
"""
pass
这工作正常。
现在我喜欢将这些 test_summaries 收集到一个自己的文件中。 现在的例子:
File collection_of_test_summaries:
Test_summary
This is the test summary one
这也有效。 但我喜欢打印出函数名,在这里:每个指令的“test_sphinx”,就像这样:
File collection_of_test_summaries:
test_sphinx:
Test_summary
This is the test summary one
根据 Sphinx ToDo 示例,我有文档(模块)名称,但找不到函数名称。
Sphinx ToDo 示例: https://www.sphinx-doc.org/en/master/development/tutorials/todo.html
【问题讨论】:
标签: python pytest python-sphinx