Sunday 7 March 2021

Get Test Coverage Sphinx "testcode" Directive

I have a number of tests in my Sphinx document. I choose to use the .. testcode:: directive over the .. doctest:: directive and standard doctest syntax because I want the output to resemble standard code blocks .. code-block::.

enter image description here

Using sphinx.ext.doctest, I can run my tests without any problems. The issue I am now having is getting test coverage. I looked at standard doctest and found a number of ways to accomplish this. One using doctest.DocTestSuite but this does not recognize the Sphinx testcodedirectives. I looked at sphinx.ext.coverage but it seems it is only for coverage of documentation. Is there a way to get a test coverage overview like that with unitest and coverage from Sphinx when using testcode directive.



from Get Test Coverage Sphinx "testcode" Directive

No comments:

Post a Comment