Skip to content

Provide a supported API for access to raw data #270

Open
@nedbat

Description

@nedbat
Owner

[From Russ Magee:]

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

beeware/duvet@15d2670

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 coverage.data.measured_files() 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 coverage.data class, or adding an entry point to coverage.data.measured_files(). Looking at the internals, however, it looks like coverage.data 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().

Activity

nedbat

nedbat commented on Jan 11, 2017

@nedbat
OwnerAuthor

Original comment by Loic Dachary (Bitbucket: dachary, GitHub: dachary)


This was mostly implemented in the CoverageData API a few years later. @nedbat is it still relevant ?

added
apiChanges to the public API
and removed on Jan 15, 2020
ProsperousHeart

ProsperousHeart commented on Mar 20, 2023

@ProsperousHeart
Contributor

Since this is so stale and may be implemented already, perhaps this is an issue to be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiChanges to the public API

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nedbat@ProsperousHeart

        Issue actions

          Provide a supported API for access to raw data · Issue #270 · nedbat/coveragepy