I'm trying to figure out how to get doctest working with Sphinx, but it doesn't seem to be finding my tests. I have the following simple example.
def my_func():
'''
Dummy test function. Returns the number 5.
.. doctest::
>>> my_func()
5
'''
return 5
When I run make doctest
, the output tells me that there were zero tests. I'm pretty sure I have things configured correctly because if I run make html
and then go to my index.html file, I see the function my_func()
included in the documentation.
Am I overlooking something simple here? Thanks for your help.
Even if it was already solved in the comment, here the answer to help people visiting the question, finding the solution easier.
The problem was the indent of the block of the doctest:
only the lines that are indented after the doctest block are considered part of the test and are tested.