【问题标题】:Leave setUp and tearDown unittest methods out of Sphinx documentation将 setUp 和 tearDown 单元测试方法从 Sphinx 文档中移除
【发布时间】:2014-05-06 01:41:37
【问题描述】:

我正在使用 docstrings 和 autodoc 为我使用 Sphinx 的项目构建文档。我喜欢在我的文档中包含测试类和实际测试用例的描述,但我想省略 setUp 和 tearDown。我尝试在 .rst 文件中指定它,但我这不起作用(并不是我真正期望的那样,我相当确定 undoc-members 仅适用于顶级构造 - 全局函数和类)

API.tests.test_MSSQLTools module
--------------------------------

.. automodule:: API.tests.test_MSSQLTools
    :members:
    :undoc-members: setUp, tearDown
    :show-inheritance:

有谁知道设置 sphinx 的方法,这样 setUp 和 tearDown 方法甚至不会出现在文档中?

【问题讨论】:

    标签: python python-sphinx


    【解决方案1】:

    你需要:

    :exclude-members: setUp, tearDown
    

    undoc-members 告诉 sphinx 记录没有文档字符串的偶数方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-05
      • 1970-01-01
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-14
      • 1970-01-01
      相关资源
      最近更新 更多