Better class coverage reporting in xml?

Anonymous avatarAnonymous created an issue

I'm running coverage (via django-jenkins, but that's irrelevant) and using the XML report with the cobertura plugin to generate reports. I have to say it's incredibly handy.

One niggle, though, is that the xml report treats the whole of a module as the source of a single "class" (so my coverage reports claim: "classes 1/1"). It looks from a very cursory glance that the parser is spotting the start of class definitions, but not necessarily their corresponding ends.

Does coverage.py currently gather enough information to (conceptually, at least) produce a class-by-class breakdown in the XML report? If not, what additional support in the parsing is going to be required to help make this work?

Cheers.

Comments (3)

  1. Ned Batchelder

    The problem with trying to map the code to Cobertura more closely is that Cobertura is based on the structure of Java code, where every line of code is part of some class. In Python, there are functions and even just plain statements outside of classes. If we map Python classes onto Cobertura classes, then we have to figure out where to put the non-class code. And that's even before we get to the question of how to actually parse it all out.

    Patches welcome! :-)

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.