-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixes.py
More file actions
70 lines (58 loc) · 2.19 KB
/
test_fixes.py
File metadata and controls
70 lines (58 loc) · 2.19 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
#!/usr/bin/env python3
"""
Quick test script to verify critical fixes work.
Run this to check if the system can start without errors.
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
def test_imports():
"""Test all critical imports work."""
try:
from backend.trading.weex_client import WeexClient
from backend.trading.paper_trader import PaperTrader
from backend.governance.rule_engine import GovernanceEngine
from backend.monitoring.real_time_analytics import RealTimePerformanceMonitor
print("✅ All imports successful")
return True
except Exception as e:
print(f"❌ Import error: {e}")
return False
def test_basic_functionality():
"""Test basic object creation and method calls."""
try:
from backend.trading.weex_client import WeexClient
from backend.trading.paper_trader import PaperTrader
from backend.governance.rule_engine import GovernanceEngine
from backend.monitoring.real_time_analytics import RealTimePerformanceMonitor
# Test WeexClient
client = WeexClient()
# Test PaperTrader
trader = PaperTrader() # Initializes with default config
assert trader.config is not None
assert trader.governance is not None
assert len(trader.governance.rules) == 12
# Test monitor
monitor = RealTimePerformanceMonitor(use_database=False)
metrics = monitor.calculate_metrics()
assert "total_pnl" in metrics
print("✅ Basic functionality tests passed")
return True
except Exception as e:
print(f"❌ Functionality error: {e}")
import traceback
traceback.print_exc()
return False
def main():
print("🔧 Testing ChronosX critical fixes...")
success = True
success &= test_imports()
success &= test_basic_functionality()
if success:
print("\n🎉 All tests passed! System is ready for competition.")
else:
print("\n💥 Some tests failed. Check errors above.")
return success
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)