-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun_tests.py
More file actions
executable file
·71 lines (57 loc) · 1.89 KB
/
Copy pathrun_tests.py
File metadata and controls
executable file
·71 lines (57 loc) · 1.89 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
"""
Test runner for forecasting agent tests.
"""
import sys
import os
import subprocess
import argparse
def run_tests(test_type='all', verbose=False):
"""Run tests based on type."""
# Add project root to path
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
# Build pytest command
cmd = ['python', '-m', 'pytest']
if verbose:
cmd.append('-v')
# Add test paths based on type
if test_type == 'unit':
cmd.append('tests/unit/')
elif test_type == 'integration':
cmd.append('tests/integration/')
elif test_type == 'e2e':
cmd.append('tests/e2e/')
elif test_type == 'all':
cmd.append('tests/')
else:
print(f"Unknown test type: {test_type}")
return False
# Add coverage if available
try:
import coverage
cmd.extend(['--cov=src', '--cov-report=html', '--cov-report=term'])
except ImportError:
print("Coverage not available, running tests without coverage")
print(f"Running {test_type} tests...")
print(f"Command: {' '.join(cmd)}")
# Run tests
result = subprocess.run(cmd, cwd=project_root)
return result.returncode == 0
def main():
"""Main entry point."""
parser = argparse.ArgumentParser(description='Run forecasting agent tests')
parser.add_argument('--type', choices=['unit', 'integration', 'e2e', 'all'],
default='all', help='Type of tests to run')
parser.add_argument('--verbose', '-v', action='store_true',
help='Verbose output')
args = parser.parse_args()
success = run_tests(args.type, args.verbose)
if success:
print("✅ All tests passed!")
sys.exit(0)
else:
print("❌ Some tests failed!")
sys.exit(1)
if __name__ == '__main__':
main()