-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
48 lines (40 loc) · 1.18 KB
/
run_tests.py
File metadata and controls
48 lines (40 loc) · 1.18 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
# __define-ocg__ Test Runner Script
"""
Simple test runner for the ML Challenge project.
"""
import subprocess
import sys
import os
from pathlib import Path
def run_tests():
"""Run the test suite"""
print("🧪 Running ML Challenge Test Suite")
print("=" * 50)
# Check if pytest is available
try:
import pytest
except ImportError:
print("❌ pytest not found. Installing...")
subprocess.run([sys.executable, "-m", "pip", "install", "pytest", "pytest-cov"])
# Run tests
print("📁 Running tests from tests/ directory...")
# Change to project root if needed
project_root = Path(__file__).parent
os.chdir(project_root)
# Run pytest with coverage
result = subprocess.run([
sys.executable, "-m", "pytest",
"tests/",
"-v",
"--cov=src",
"--cov-report=term-missing",
"--cov-report=html:htmlcov"
])
if result.returncode == 0:
print("\n✅ All tests passed!")
print("📊 Coverage report generated in htmlcov/ directory")
else:
print("\n❌ Some tests failed!")
sys.exit(1)
if __name__ == "__main__":
run_tests()