Classes
CoverageResult
7
▼
Coverage data for a single template.
CoverageResult
7
▼
Coverage data for a single template.
Attributes
| Name | Type | Description |
|---|---|---|
template_name |
str
|
— |
executed_lines |
frozenset[int]
|
— |
total_lines |
frozenset[int]
|
— |
Methods
hit_count
0
int
▼
property
hit_count
0
int
▼
def hit_count(self) -> int
Returns
int
total_count
0
int
▼
property
total_count
0
int
▼
def total_count(self) -> int
Returns
int
missed_count
0
int
▼
property
missed_count
0
int
▼
def missed_count(self) -> int
Returns
int
percentage
0
float
▼
property
percentage
0
float
▼
def percentage(self) -> float
Returns
float
CoverageCollector
14
▼
Collects template line coverage during rendering.
Dynamically patches ``RenderContext.__setattr__`…
CoverageCollector
14
▼
Collects template line coverage during rendering.
Dynamically patchesRenderContext.__setattr__while active so
there is zero overhead when coverage is disabled (the normal case).
Attributes
| Name | Type | Description |
|---|---|---|
_active_count |
int
|
— |
Methods
data
0
dict[str, set[int]]
▼
Raw coverage data: {template_name: {executed_lines}}.
property
data
0
dict[str, set[int]]
▼
def data(self) -> dict[str, set[int]]
Returns
dict[str, set[int]]
start
0
▼
Start collecting coverage data.
start
0
▼
def start(self) -> None
stop
0
▼
Stop collecting coverage data.
stop
0
▼
def stop(self) -> None
clear
0
▼
Clear all collected data.
clear
0
▼
def clear(self) -> None
get_results
1
list[CoverageResult]
▼
Get coverage results for all tracked templates.
get_results
1
list[CoverageResult]
▼
def get_results(self, source_map: dict[str, frozenset[int]] | None = None) -> list[CoverageResult]
Parameters
| Name | Type | Description |
|---|---|---|
source_map |
— |
Optional mapping of template_name to all trackable line numbers. If not provided, total_lines equals executed_lines (100% coverage for all touched templates — useful for hit tracking even without full line enumeration). Default:None
|
Returns
list[CoverageResult]
List of CoverageResult per template, sorted by name.
summary
1
str
▼
Generate a text summary of coverage.
summary
1
str
▼
def summary(self, source_map: dict[str, frozenset[int]] | None = None) -> str
Parameters
| Name | Type | Description |
|---|---|---|
source_map |
— |
Default:None
|
Returns
str
write_lcov
1
▼
Write coverage data in LCOV tracefile format.
write_lcov
1
▼
def write_lcov(self, path: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
path |
— |
format_lcov
0
str
▼
Format coverage data as LCOV tracefile string.
format_lcov
0
str
▼
def format_lcov(self) -> str
Returns
str
format_cobertura
0
str
▼
Format coverage data as Cobertura XML string.
format_cobertura
0
str
▼
def format_cobertura(self) -> str
Returns
str
write_cobertura
1
▼
Write coverage data in Cobertura XML format.
write_cobertura
1
▼
def write_cobertura(self, path: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
path |
— |
Internal Methods 3 ▼
__init__
0
▼
__init__
0
▼
def __init__(self) -> None
__enter__
0
CoverageCollector
▼
__enter__
0
CoverageCollector
▼
def __enter__(self) -> CoverageCollector
Returns
CoverageCollector
__exit__
1
▼
__exit__
1
▼
def __exit__(self, *args: object) -> None
Parameters
| Name | Type | Description |
|---|---|---|
*args |
— |
Functions
_coverage_setattr
3
None
▼
Patched __setattr__ that records line hits for coverage.
_coverage_setattr
3
None
▼
def _coverage_setattr(self: RenderContext, name: str, value: object) -> None
Parameters
| Name | Type | Description |
|---|---|---|
self |
RenderContext |
|
name |
str |
|
value |
object |