sphinx_reports.Adapter.Coverage

A Sphinx extension providing code coverage details embedded in documentation pages.

Exceptions

Classes

  • Analyzer: An analyzer to read and transform code coverage data from JSON format to a generic data model.


Exceptions

exception sphinx_reports.Adapter.Coverage.CodeCoverageError(message, orig_exc=None, modname=None)[source]

Inheritance

Inheritance diagram of CodeCoverageError

Parameters:
Return type:

None


Classes

class sphinx_reports.Adapter.Coverage.Analyzer(packageName, jsonCoverageFile)[source]

An analyzer to read and transform code coverage data from JSON format to a generic data model.

Coverage.py can provide collected statement and branch coverage metrics as JSON data, which can be converted to a generic code coverage model.

Inheritance

Inheritance diagram of Analyzer

Parameters:
  • packageName (str)

  • jsonCoverageFile (Path)

__init__(packageName, jsonCoverageFile)[source]

Read a JSON file containing code coverage metrics generated by Coverage.py.

Parameters:
  • packageName (str) – Name of the Python package that was analyzed.

  • jsonCoverageFile (Path) – JSON file containing statement and/or branch coverage.

Raises:

CodeCoverageError – If JSON file doesn’t exist.

Return type:

None

property PackageName: str

Read-only property to access the analyzed package’s name.

Returns:

Name of the analyzed package.

property JSONCoverageFile: Path

Read-only property to access the parsed JSON file.

Returns:

Path to the parsed JSON file.