-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_basic_tests.py
More file actions
89 lines (68 loc) · 2.7 KB
/
run_basic_tests.py
File metadata and controls
89 lines (68 loc) · 2.7 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
"""Run basic tests for CausalBoundingEngine package.
This script runs a subset of tests that work with minimal dependencies.
"""
import sys
import subprocess
import os
def run_tests():
"""Run basic functionality tests."""
# Change to project root directory
project_root = os.path.dirname(os.path.abspath(__file__))
os.chdir(project_root)
# Test files to run (in order of importance)
test_files = [
'tests/test_dummy.py',
'tests/test_core_algorithms.py',
'tests/test_scenarios.py::TestDataClass',
'tests/test_scenarios.py::TestScenarioBase',
'tests/test_integration.py::TestDataHandling',
]
print("🧪 Running CausalBoundingEngine Basic Tests\n")
print("=" * 50)
results = {}
for test_file in test_files:
print(f"\n📋 Running {test_file}...")
print("-" * 40)
try:
# Run pytest for this test file
cmd = [
sys.executable, '-m', 'pytest',
test_file,
'-v',
'--tb=short'
]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
print(f"✅ {test_file}: PASSED")
results[test_file] = 'PASSED'
else:
print(f"❌ {test_file}: FAILED")
print(f"Error output:\n{result.stdout}")
if result.stderr:
print(f"Stderr:\n{result.stderr}")
results[test_file] = 'FAILED'
except Exception as e:
print(f"💥 {test_file}: ERROR - {str(e)}")
results[test_file] = 'ERROR'
# Summary
print("\n" + "=" * 50)
print("📊 TEST SUMMARY")
print("=" * 50)
passed = sum(1 for r in results.values() if r == 'PASSED')
failed = sum(1 for r in results.values() if r == 'FAILED')
errors = sum(1 for r in results.values() if r == 'ERROR')
for test_file, result in results.items():
emoji = "✅" if result == "PASSED" else "❌" if result == "FAILED" else "💥"
print(f"{emoji} {test_file}: {result}")
print(f"\nTotal: {len(results)} tests")
print(f"✅ Passed: {passed}")
print(f"❌ Failed: {failed}")
print(f"💥 Errors: {errors}")
if failed == 0 and errors == 0:
print("\n🎉 All basic tests passed! The core package functionality is working.")
else:
print(f"\n⚠️ Some tests failed. The package may still work, but check the failures above.")
return failed + errors == 0
if __name__ == "__main__":
success = run_tests()
sys.exit(0 if success else 1)