Add the repository-facing scaffolding: - Community/legal: README.md, LICENSE (GPL-3.0-or-later), NOTICE, CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, .gitleaks.toml - CI: .github/ workflows (ci.yml aggregate gate, nightly.yml, codeql.yml), issue/PR templates, dependabot config (pinned Actions per README) - Host tooling: tools/frame_tools (ruff/pyright/pytest gates, partition, evidence-schema, doc-links, SBOM checks), tests/, pyproject.toml, uv.lock - poc/ host side: poc/host contract-test suite (ASan/TSan-capable), poc/README.md, poc/poc-a.code-workspace Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
24 lines
642 B
Python
24 lines
642 B
Python
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from frame_tools.coverage import branch_percentage
|
|
|
|
|
|
def test_reads_llvm_branch_percentage(tmp_path: Path) -> None:
|
|
report = tmp_path / "coverage.json"
|
|
report.write_text(
|
|
json.dumps({"data": [{"totals": {"branches": {"percent": 91.25}}}]}),
|
|
encoding="utf-8",
|
|
)
|
|
|
|
assert branch_percentage(report) == 91.25
|
|
|
|
|
|
def test_rejects_invalid_llvm_export(tmp_path: Path) -> None:
|
|
report = tmp_path / "coverage.json"
|
|
report.write_text("{}", encoding="utf-8")
|
|
|
|
with pytest.raises(ValueError, match="invalid llvm-cov export"):
|
|
branch_percentage(report)
|