Jinja Reporter
ReportJinja
¶
ReportJinja(template_path: Path)
Report builder based on a Jinja2 template.
render
¶
render(
data: list[dict[str, Any]],
*,
trim_blocks: bool = True,
lstrip_blocks: bool = True
) -> str
Build a report based on a Jinja2 template.
Report is built based on a J2 template provided by user. Data structure sent to template is:
Example
>>> print(ResultManager.json)
[
{
name: ...,
test: ...,
result: ...,
messages: [...]
categories: ...,
description: ...,
}
]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[dict[str, Any]]
|
List of results from |
required |
trim_blocks
|
bool
|
enable trim_blocks for J2 rendering. |
True
|
lstrip_blocks
|
bool
|
enable lstrip_blocks for J2 rendering. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Rendered template |
Source code in anta/reporter/__init__.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |