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:

But surprisingly this pull request lowers the test coverage:

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 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 is being used to measure during doctests?

  2. Ned Batchelder repo owner

    @gforcada 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. Ned Batchelder repo owner

    @tisto I don't see why a transation.commit() would stop coverage measurement. If you have a reproducible case, please open a new issue. Thanks.

  4. Log in to comment