-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
executable file
·94 lines (77 loc) · 2.46 KB
/
run_tests.py
File metadata and controls
executable file
·94 lines (77 loc) · 2.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
"""
Test runner script for AutoRebase API
"""
import subprocess
import sys
import os
def run_tests():
"""Run all tests"""
print("AutoRebase API Test Runner")
print("=" * 50)
# Check if pytest is installed
try:
import pytest
except ImportError:
print("❌ pytest not found. Installing...")
subprocess.run([sys.executable, "-m", "pip", "install", "pytest", "pytest-asyncio"])
# Run unit tests
print("\n🧪 Running Unit Tests...")
result = subprocess.run([
sys.executable, "-m", "pytest",
"tests/test_models.py",
"tests/test_services.py",
"tests/test_autorebase.py",
"-v", "--tb=short"
])
if result.returncode != 0:
print("❌ Unit tests failed!")
return False
# Run integration tests
print("\n🔗 Running Integration Tests...")
result = subprocess.run([
sys.executable, "-m", "pytest",
"tests/test_api_endpoints.py",
"-v", "--tb=short"
])
if result.returncode != 0:
print("❌ Integration tests failed!")
return False
print("\n✅ All tests passed!")
return True
def run_manual_tests():
"""Run manual tests (requires running server)"""
print("Manual Test Runner")
print("=" * 50)
print("⚠️ Make sure the server is running: python main.py")
print()
try:
from tests.test_api import run_manual_tests
run_manual_tests()
except ImportError as e:
print(f"❌ Error importing manual tests: {e}")
def run_simple_tests():
"""Run simple manual tests (convenience function)"""
print("Simple Test Runner")
print("=" * 50)
print("⚠️ Make sure the server is running: python main.py")
print()
try:
from tests.test_api import run_simple_tests
run_simple_tests()
except ImportError as e:
print(f"❌ Error importing simple tests: {e}")
if __name__ == "__main__":
if len(sys.argv) > 1:
if sys.argv[1] == "manual":
run_manual_tests()
elif sys.argv[1] == "simple":
run_simple_tests()
else:
print("Usage: python run_tests.py [manual|simple]")
print(" manual: Run pytest-based manual tests")
print(" simple: Run simple manual tests")
print(" (no args): Run automated test suite")
else:
success = run_tests()
sys.exit(0 if success else 1)