Question

I'm using docstrings and autodoc to build documentation for my project using Sphinx. I like having descriptions of the testing classes and actual test cases in my documentation, but I would like to leave out the setUp and tearDown. I tried specifying this in the .rst file, but I this didn't work (not that I really expected it to, I'm fairly certain undoc-members only applies to top level constructs - global functions and classes)

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

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

Does anyone know of a way to set up sphinx so that the setUp and tearDown methods don't even show up in the docs?

Was it helpful?

Solution

You will need:

:exclude-members: setUp, tearDown

undoc-members tells sphinx to document even methods without docstrings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top