-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
64 lines (54 loc) · 1.72 KB
/
tests.py
File metadata and controls
64 lines (54 loc) · 1.72 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
import os
import subprocess
import sys
def run_test_file(filename):
print(f"Running {filename}...")
try:
# Run the test as a subprocess
result = subprocess.run([sys.executable, filename], capture_output=True, text=True)
# Print output regardless of success for logs
print(result.stdout)
if result.stderr:
print(f"Error Output:\n{result.stderr}", file=sys.stderr)
# Check if the process exited with non-zero
if result.returncode != 0:
return False
# Check output for failure patterns like '[x]'
if "[x]" in result.stdout:
return False
return True
except Exception as e:
print(f"Failed to execute {filename}: {e}", file=sys.stderr)
return False
def main():
# List of core tests to run for CI validation
core_tests = [
"test_parser.py",
"test_engine.py",
"test_storage.py",
"test_crud.py",
"test_join.py",
"test_metadata.py",
"test_transactions.py",
"test_alter_table.py",
"test_column_management.py"
]
passed_all = True
for test in core_tests:
if not os.path.exists(test):
print(f"Warning: Test file {test} not found, skipping.")
continue
if not run_test_file(test):
print(f"FAILED: {test}")
passed_all = False
else:
print(f"PASSED: {test}")
print("-" * 40)
if not passed_all:
print("Final Result: FAIL")
sys.exit(1)
else:
print("Final Result: ALL TESTS PASSED")
sys.exit(0)
if __name__ == "__main__":
main()