coveragepy / coveragepy/coveragepy

Support method-level coverage in Cobertura XML files

Open
#2,056 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
3.4k
Forks
525
Avg merge
18h 27m
Merged PRs (30d)
6

Description

As per an enlightening discussion with @nedbat on a Discord thread, coverage.py already reports on function and class coverages. This is achieved through HTML reports, in which we can see "Files, Functions, Classes" at the top of the index page.

However, the (Cobertura) XML report doesn't expose the same information. Instead, the coverage.py's xml report will show empty <methods/> entries

My feature request is to populate the the XML report with the function/methods coverage info. A sample XML on how the content should look like can be seen here

This feature would be helpful for rendering tools to easily report on/parse coverage information and possibly fail CI/CD runs when coverage is low for at the method-level coverage.

As a side note - but probably unrelated to the request, is that another project named fun-coverage implemented method-coverage on terminal-only.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing coverage.py's Cobertura XML report generation and compare it with the HTML report's function and class coverage data. Review the linked Cobertura sample to determine the expected method structure. Done means the XML report contains method-level coverage information and existing report behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.