forked from flatironinstitute/figpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
63 lines (50 loc) · 1.46 KB
/
run_tests.py
File metadata and controls
63 lines (50 loc) · 1.46 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
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Simple test runner script for figpack
"""
import subprocess
import sys
import os
def run_command(cmd, description):
"""Run a command and handle errors"""
print(f"\n{'='*60}")
print(f"Running: {description}")
print(f"Command: {' '.join(cmd)}")
print(f"{'='*60}")
result = subprocess.run(cmd, capture_output=False)
if result.returncode != 0:
print(f"\n❌ {description} failed with exit code {result.returncode}")
return False
else:
print(f"\n✅ {description} passed")
return True
def main():
"""Main test runner"""
print("🧪 Running figpack test suite")
# Change to project directory
os.chdir(os.path.dirname(os.path.abspath(__file__)))
success = True
# Run tests with coverage
if not run_command(
[
"python",
"-m",
"pytest",
"--cov=figpack",
"--cov-report=term-missing",
"--cov-report=html",
],
"Running tests with coverage",
):
success = False
# Run tests without coverage for faster feedback
if not run_command(["python", "-m", "pytest", "-v"], "Running tests (verbose)"):
success = False
if success:
print(f"\n🎉 All tests passed!")
print("📊 Coverage report generated in htmlcov/index.html")
else:
print(f"\n💥 Some tests failed!")
sys.exit(1)
if __name__ == "__main__":
main()