-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_fast_tests.py
More file actions
71 lines (57 loc) · 1.93 KB
/
run_fast_tests.py
File metadata and controls
71 lines (57 loc) · 1.93 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
#!/usr/bin/env python3
"""
Fast Test Runner
This script runs only the fast tests for quick validation of the GNN pipeline.
It's designed to complete in under 30 seconds and provide basic confidence
that the system is working correctly.
"""
import subprocess # nosec B404 -- subprocess calls with controlled/trusted input
import sys
import time
from pathlib import Path
def run_fast_tests() -> bool:
"""Run only the fast tests."""
print("Running fast test suite...")
start_time = time.time()
# Prepare pytest command for fast tests only
pytest_cmd = [
sys.executable, "-m", "pytest",
"--quiet",
"--tb=short",
"--maxfail=5",
"--durations=5",
"--disable-warnings",
"-m", "fast",
"src/tests/test_fast_suite.py"
]
# Add timeout plugin if available
# Timeout configuration is handled by pytest.ini or defaults
pytest_cmd.extend(["--timeout=10"])
try:
# Run pytest with 60 second timeout
result = subprocess.run( # nosec B603 -- subprocess calls with controlled/trusted input
pytest_cmd,
capture_output=True,
text=True,
cwd=Path(__file__).parent.parent.parent, # Project root
timeout=60
)
elapsed_time = time.time() - start_time
print(f"Fast tests completed in {elapsed_time:.2f} seconds")
print(f"Exit code: {result.returncode}")
if result.stdout:
print("Test output:")
print(result.stdout)
if result.stderr:
print("Test errors:")
print(result.stderr)
return result.returncode == 0
except subprocess.TimeoutExpired:
print("Fast tests timed out after 60 seconds")
return False
except Exception as e:
print(f"Error running fast tests: {e}")
return False
if __name__ == "__main__":
success = run_fast_tests()
sys.exit(0 if success else 1)