doctests are not counted for coverage

Issue #377 closed
Gil Forcada Codinachs
created an issue

At Plone we have a distribution to do code analysis: plone.recipe.codeanalysis

I made a pull request for it: https://github.com/plone/plone.recipe.codeanalysis/pull/125

But surprisingly this pull request lowers the test coverage: https://coveralls.io/builds/2679558

Given the changes seems that coverage does not count doctest tests as part of the coverage. Is that a known issue?

Comments (7)

  1. Ned Batchelder repo owner

    Coverage.py doesn't know why code is executed. It just knows that it was executed. Are you sure your test suite is running the doctests? Are you sure coverage.py is being used to measure during doctests?

  2. Ned Batchelder repo owner

    @Gil Forcada Codinachs Looking at the pull request, it added doctests in a .rst file, and also added 4 Python lines to install_pre_commit_hook. The coveralls report says install_pre_commit_hook isn't executed, so you've got 4 new lines in an unexecuted file. That would reduce the coverage.

    I don't understand the doctests, (what does "system(buildout)" do, buildout doesn't seem to be defined?) did you expect them to invoke install_pre_commit_hook? Perhaps this is really about not measuring subprocesses properly?

  3. Log in to comment