Provide a supported API for access to raw data

Issue #270 closed
Ned Batchelder repo owner created an issue

[From Russ Magee:]

After our conversation on Twitter yesterday about Duvet, I took a look a look at making better use of's internals. The result wasn't that bad:

You suggested that you were would be interested in feedback on what needs to be formalised to make this sort of thing easier -- here's my 2c/wishlist:

  • Make coverage.load() raise an exception if the coverage file doesn't exist. At present it's a silent failure, covered by a catch-all exception. I've worked around this by checking if is empty, but it really should be an exception IMHO.
  • Provide formal access to the list of files/modules that the coverage data spans. This could be done by either formalising the class, or adding an entry point to Looking at the internals, however, it looks like has some other potentially useful API endpoints, so formalizing might be the better approach.
  • Provide access to the individual file coverage/branch coverage percentage, and the overall project coverage percentage. As it stands I need to invoke coverage._analyze() and handle the resultant Numbers instances, rather than coverage.analysis()/analysis2().

Comments (3)

  1. Log in to comment