Test coverage reporting

Use this plugin to activate coverage report.

To install this plugin, you need to activate coverage-plugin with extra requirements :

$ pip install nose2[coverage-plugin]

Next, you can enable coverage reporting with :

$ nose2 --with-coverage

Or with this lines in unittest.cfg :

[coverage]
always-on = True

Configuration [coverage]

always-on
Default:False
Type:boolean
coverage
Default:[]
Type:list
coverage-config
Default:
Type:str
coverage-report
Default:[]
Type:list

Sample configuration

The default configuration is equivalent to including the following in a unittest.cfg file.

[coverage]
always-on = False
coverage = 
coverage-config = 
coverage-report = 

Command-line options

--coverage PATH

Measure coverage for filesystem path (multi-allowed)

--coverage-report TYPE

Generate selected reports, available types: term, term-missing, annotate, html, xml (multi-allowed)

--coverage-config FILE

Config file for coverage, default: .coveragerc

-C DEFAULT, --with-coverage DEFAULT

Turn on coverage reporting

Plugin class reference: Coverage

class nose2.plugins.coverage.Coverage[source]
afterSummaryReport(event)[source]

Only called if active so stop coverage and produce reports.

handleArgs(event)[source]

Get our options in order command line, config file, hard coded.

startTestRun(event)[source]

Only called if active so start coverage.

Table Of Contents

Previous topic

Capturing log messages

Next topic

Outputting XML Test Reports

This Page