Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sphinx coverage generates empty python.txt file

I'm using Sphinx to document my project. I've enabled the sphinx.ext.coverage extension in my configuration file. I'm running the following command to generate the coverage report (as guided by this answer:

bash-3.2$ sphinx-build -v -b coverage . _build/coverage/
Making output directory...
Running Sphinx v1.2.3
loading pickled environment... not yet created
building [coverage]: coverage overview
updating environment: 10 added, 0 changed, 0 removed
...
reading sources... [100%] modules
looking for now-outdated files... none found
pickling environment... done
checking consistency... /some/path/modules.rst:: WARNING: document isn't included in any toctree
done
build succeeded, 17 warnings.

If I look inside _build/coverage/python.txt, all I see is:

Undocumented Python objects
===========================

This isn't quite right, since there are definitely parts of my project that aren't documented.

Somebody posted about this on the sphinx mailing list, but didn't get any replies.

Does anybody know what the problem is? How do I fix it?

like image 289
mpenkov Avatar asked Oct 24 '14 09:10

mpenkov


2 Answers

One thing to consider -- if you are using :undoc-members:, they will be considered documented, even though they are nothing more than a stub. This was what was causing me to have no results.

like image 89
Shookit Avatar answered Nov 20 '22 00:11

Shookit


If your function has no docstring but is specified in the 'contents' part of your .rst file, then it would still be considered as 'covered' by the coverage builder, and not stand in your python.txt

like image 3
PoloCornichon Avatar answered Nov 19 '22 23:11

PoloCornichon