Repository navigation
Expand file tree
/
Copy pathrun_tests.py
More file actions
84 lines (69 loc) · 2.44 KB
/
Copy pathrun_tests.py
File metadata and controls
84 lines (69 loc) · 2.44 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
"""
Test runner for FLIT ML project with proper test organization
"""
import subprocess
import sys
import os
def run_tests():
"""Run all tests with proper categorization."""
print("🧪 Running FLIT ML Test Suite")
print("=" * 50)
success = True
# Unit Tests
print("\n📦 UNIT TESTS")
print("-" * 30)
unit_tests = [
("Feature Engineering", "tests/unit/features/test_feature_engineering.py"),
("Unknown Categories", "tests/unit/features/test_unknown_categories.py"),
("Multi-Model Predictor", "tests/unit/models/test_multi_model_predictor.py")
]
for test_name, test_file in unit_tests:
print(f"\n🔹 {test_name}")
try:
result = subprocess.run([sys.executable, test_file],
capture_output=True, text=True, cwd=os.getcwd())
if result.returncode == 0:
print(f"✅ PASS")
else:
print(f"❌ FAIL")
print(f"Error: {result.stderr}")
success = False
except Exception as e:
print(f"❌ ERROR: {e}")
success = False
# Integration Tests
print(f"\n🔗 INTEGRATION TESTS")
print("-" * 30)
integration_tests = [
("Production Artifacts", "poetry run pytest tests/integration/test_production_artifacts.py -v"),
("API Endpoints", "tests/integration/test_api_endpoints.py")
]
for test_name, test_command in integration_tests:
print(f"\n🔹 {test_name}")
try:
if test_command.startswith("poetry"):
result = subprocess.run(test_command.split(),
capture_output=True, text=True, cwd=os.getcwd())
else:
result = subprocess.run([sys.executable, test_command],
capture_output=True, text=True, cwd=os.getcwd())
if result.returncode == 0:
print(f"✅ PASS")
else:
print(f"❌ FAIL")
print(f"Error: {result.stderr}")
success = False
except Exception as e:
print(f"❌ ERROR: {e}")
success = False
# Summary
print(f"\n{'=' * 50}")
if success:
print("🎉 All tests passed!")
return 0
else:
print("❌ Some tests failed!")
return 1
if __name__ == "__main__":
sys.exit(run_tests())