Download tests/test_coverage.py from tailot/codex-python: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/datasets/tailot/codex-python/resolve/main/tests/test_coverage.py
- Command line
-
hf download hf://datasets/tailot/codex-python/tests/test_coverage.py
-
curl -L -o test_coverage.py https://huggingface.co/datasets/tailot/codex-python/resolve/main/tests/test_coverage.py
1.32 kB
| """The suite enters the package it ships: a floor keeps dark corners from piling up.""" | |
| from __future__ import annotations | |
| import json | |
| import os | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| ROOT = Path(__file__).resolve().parents[1] | |
| # Measured at 95.9 percent when this floor was first written; ten points of | |
| # margin let one refactor breathe without letting a whole module go dark. | |
| FLOOR = 90.0 | |
| def test_the_suite_enters_most_of_the_package_it_ships(tmp_path: Path) -> None: | |
| report = tmp_path / "coverage.json" | |
| status = subprocess.run( | |
| [ | |
| sys.executable, | |
| "-B", | |
| "tools/measure_coverage.py", | |
| "--floor", | |
| str(FLOOR), | |
| "--report", | |
| str(report), | |
| ], | |
| cwd=str(ROOT), | |
| stdout=subprocess.DEVNULL, | |
| stderr=subprocess.DEVNULL, | |
| ).returncode | |
| assert status == 0, "the traced suite failed or the coverage floor was missed" | |
| payload = json.loads(report.read_text(encoding="utf-8")) | |
| assert payload["percent"] >= FLOOR | |
| assert payload["total"] > 100, "a denominator that small measures nothing" | |