-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_coverage.py
More file actions
50 lines (38 loc) · 1.21 KB
/
run_coverage.py
File metadata and controls
50 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""Run coverage analysis and report blind spots.
Usage:
python scripts/run_coverage.py # Full report
python scripts/run_coverage.py --summary # Summary only
python scripts/run_coverage.py --html # Generate HTML report
"""
import subprocess
import sys
def main() -> int:
args = sys.argv[1:]
summary_only = "--summary" in args
html_report = "--html" in args
cmd = [
sys.executable, "-m", "pytest", "tests/",
"-q", "--tb=no",
"--cov=divineos",
"--cov-branch",
"--cov-report=term-missing",
]
if html_report:
cmd.append("--cov-report=html:coverage_html")
result = subprocess.run(cmd, capture_output=not summary_only)
if summary_only:
# Re-run with just the summary
cmd_summary = [
sys.executable, "-m", "pytest", "tests/",
"-q", "--tb=no",
"--cov=divineos",
"--cov-branch",
"--cov-report=term",
]
result = subprocess.run(cmd_summary)
if html_report:
print("\nHTML report generated: coverage_html/index.html")
return result.returncode
if __name__ == "__main__":
raise SystemExit(main())