-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
53 lines (43 loc) · 1.1 KB
/
Copy pathrun_tests.py
File metadata and controls
53 lines (43 loc) · 1.1 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
51
52
53
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "pytest>=7.4.0",
# "pytest-cov>=4.1.0",
# "typer>=0.12.0",
# "rich>=13.0.0",
# "pydantic>=2.5.0",
# ]
# ///
# scripts/run_tests.py
"""Test runner script for devman library."""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
def main() -> None:
"""Run pytest with coverage and formatting."""
repo_root = Path(__file__).resolve().parent.parent
test_dir = repo_root / "tests"
src_dir = repo_root / "src"
cmd = [
sys.executable,
"-m",
"pytest",
str(test_dir),
f"--cov={src_dir / 'devman'}",
"--cov-report=term-missing",
"--cov-report=html",
"-v",
"--tb=short",
]
print("Running tests with coverage...")
result = subprocess.run(cmd)
if result.returncode == 0:
print("\n✅ All tests passed!")
print("📊 Coverage report: htmlcov/index.html")
else:
print("\n❌ Some tests failed!")
sys.exit(1)
if __name__ == "__main__":
main()