Update reporting module public API
This commit is contained in:
@@ -1,5 +1,58 @@
|
|||||||
"""Report generation.
|
"""Report generation module for py_dvt_ate.
|
||||||
|
|
||||||
Generates test reports from stored data in various formats
|
This module provides automated PDF report generation from test results.
|
||||||
including PDF and HTML.
|
Reports include test metadata, results tables, pass/fail status, and charts.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
>>> from uuid import UUID
|
||||||
|
>>> from py_dvt_ate.data.repository import SQLiteRepository
|
||||||
|
>>> from py_dvt_ate.reporting import ReportGenerator, ReportConfig
|
||||||
|
>>>
|
||||||
|
>>> # Create repository and generator
|
||||||
|
>>> repo = SQLiteRepository("./data/py_dvt_ate.db")
|
||||||
|
>>> config = ReportConfig(company_name="My Company", include_charts=True)
|
||||||
|
>>> generator = ReportGenerator(repo, config)
|
||||||
|
>>>
|
||||||
|
>>> # Generate PDF report
|
||||||
|
>>> run_id = UUID("12345678-1234-1234-1234-123456789abc")
|
||||||
|
>>> pdf_path = generator.generate(run_id)
|
||||||
|
>>> print(f"Report saved to: {pdf_path}")
|
||||||
|
>>>
|
||||||
|
>>> # Or get PDF as bytes (for streaming downloads)
|
||||||
|
>>> pdf_bytes = generator.generate_bytes(run_id)
|
||||||
|
|
||||||
|
Classes:
|
||||||
|
ReportGenerator: Main class for generating PDF reports.
|
||||||
|
ReportConfig: Configuration options for report generation.
|
||||||
|
ReportData: Data container for report content.
|
||||||
|
|
||||||
|
Exceptions:
|
||||||
|
ReportingError: Base exception for reporting errors.
|
||||||
|
ReportGenerationError: General report generation failures.
|
||||||
|
TemplateRenderError: HTML template rendering failures.
|
||||||
|
PDFConversionError: HTML to PDF conversion failures.
|
||||||
|
ChartGenerationError: Chart generation failures.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from py_dvt_ate.reporting.exceptions import (
|
||||||
|
ChartGenerationError,
|
||||||
|
PDFConversionError,
|
||||||
|
ReportGenerationError,
|
||||||
|
ReportingError,
|
||||||
|
TemplateRenderError,
|
||||||
|
)
|
||||||
|
from py_dvt_ate.reporting.generator import ReportGenerator
|
||||||
|
from py_dvt_ate.reporting.models import ReportConfig, ReportData
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
# Main classes
|
||||||
|
"ReportGenerator",
|
||||||
|
"ReportConfig",
|
||||||
|
"ReportData",
|
||||||
|
# Exceptions
|
||||||
|
"ReportingError",
|
||||||
|
"ReportGenerationError",
|
||||||
|
"TemplateRenderError",
|
||||||
|
"PDFConversionError",
|
||||||
|
"ChartGenerationError",
|
||||||
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user