Get statistics for a project.
(project_dir: Path)
| 99 | |
| 100 | |
| 101 | def get_project_stats(project_dir: Path) -> ProjectStats: |
| 102 | """Get statistics for a project.""" |
| 103 | _init_imports() |
| 104 | assert _count_passing_tests is not None # guaranteed by _init_imports() |
| 105 | passing, in_progress, total = _count_passing_tests(project_dir) |
| 106 | percentage = (passing / total * 100) if total > 0 else 0.0 |
| 107 | return ProjectStats( |
| 108 | passing=passing, |
| 109 | in_progress=in_progress, |
| 110 | total=total, |
| 111 | percentage=round(percentage, 1) |
| 112 | ) |
| 113 | |
| 114 | |
| 115 | @router.get("", response_model=list[ProjectSummary]) |
no test coverage detected