in scripts/metric_reporter/reporter/coverage_reporter.py [0:0]
def _parse_pytest_report(self, pytest_report: PytestReport) -> CoverageReporterResult:
totals: PytestTotals = pytest_report.totals
return CoverageReporterResult(
repository=self.repository,
workflow=self.workflow,
test_suite=self.test_suite,
timestamp=pytest_report.job_timestamp,
date=self._extract_date(pytest_report.job_timestamp)
if pytest_report.job_timestamp
else None,
job=pytest_report.job_number,
line_count=totals.num_statements,
line_covered=totals.covered_lines,
line_not_covered=totals.missing_lines,
line_excluded=totals.excluded_lines,
line_percent=totals.percent_covered,
branch_count=totals.num_branches,
branch_covered=totals.covered_branches,
branch_not_covered=totals.missing_branches,
branch_percent=(
(totals.covered_branches / totals.num_branches) * 100
if totals.num_branches
else 0.0
),
)