"""Small fixture reports, one per supported format, all describing a.py/b.py. a.py: lines 1-5 with 2,3 and 5 missed + one missed branch on line 4. b.py: fully covered (must never be listed). """ from __future__ import annotations import json import sys from pathlib import Path import pytest sys.path.insert(0, str(Path(__file__).resolve().parents[2])) LCOV = """TN: SF:a.py DA:1,1 DA:2,0 DA:3,0 DA:4,1 DA:5,0 BRDA:4,0,0,1 BRDA:4,0,1,- end_of_record SF:b.py DA:1,3 end_of_record SF:a.py DA:1,1 DA:2,0 end_of_record """ COBERTURA = """ """ JACOCO = """ """ COVERAGE_JSON = json.dumps( { "files": { "a.py": { "executed_lines": [1, 4], "missing_lines": [2, 3, 5], "missing_branches": [[4, 5]], "summary": {"covered_branches": 1}, }, "b.py": { "executed_lines": [1], "missing_lines": [], "missing_branches": [], }, } } ) @pytest.fixture def reports(tmp_path: Path) -> dict[str, Path]: """Write each fixture report to disk, keyed by format name.""" out = {} for name, body in { "lcov": LCOV, "cobertura": COBERTURA, "jacoco": JACOCO, "json": COVERAGE_JSON, }.items(): out[name] = tmp_path / f"{name}.rpt" out[name].write_text(body, encoding="utf-8") return out