Frage

I use the Python code coverage tool to monitor and measure our testing coverage. I'm now publishing the results internally, using coverage's excellent html report generation. I'd like to change the reports generated from a flat report of all modules to a nested/hierarchical approach, such that each module would display totals for the modules within. Thus, if my current summary page looks like:

Name                         Stmts   Miss  Cover
myapp                           33     33     0%
myapp.infra                      2      0   100%
myapp.infra.mm                  34      8    76%
myapp.infra.mmcheck            140     32    77%
myapp.job                        2      2     0%
myapp.job.jobcontrol           629    445    29%
myapp.job.launcher             334    163    51%

I would instead like a summary report like:

Name                         Stmts   Miss  Cover
myapp.__init__                  33     33     0%
myapp.infra                    176     40    77%
myapp.job                      965    610    37%

Where myapp.infra links to an index for that package:

Name                         Stmts   Miss  Cover
myapp.infra.__init__             2      0   100%
myapp.infra.mm                  34      8    76%
myapp.infra.mmcheck            140     32    77%

Does a capability like this already exist, and I am simply too foolish to see it? Or will I need to customize the report generation?

War es hilfreich?

Lösung

One option is to use z3c.coverage. Quote from docs:

Why use z3c.coverage instead of coverage html?

Some people prefer the look of the reports produced by z3c.coverage. Some people find per-package coverage summaries or the tree-like navigation convenient.

Sounds like what you need. Hope that helps.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top