File size: 2,256 Bytes
8024c76 |
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 |
#!/usr/bin/env python3
"""
Test script to verify analytics are loading after config fix
"""
import sys
import os
# Add the project root to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_config_import():
"""Test if config.settings can be imported"""
print("π Testing config.settings import...")
try:
from config.settings import Config
print("β
Config import successful")
return True
except Exception as e:
print(f"β Config import failed: {e}")
return False
def test_analytics_import():
"""Test if analytics modules can be imported"""
print("π Testing analytics import...")
try:
from src.analysis.comprehensive_analytics import ComprehensiveAnalytics
print("β
Analytics import successful")
return True
except Exception as e:
print(f"β Analytics import failed: {e}")
return False
def test_app_analytics():
"""Test if the app can load analytics"""
print("π Testing app analytics loading...")
try:
# Import the app's analytics loading function
import frontend.app as app
# Check if analytics are available
if hasattr(app, 'ANALYTICS_AVAILABLE'):
print(f"β
Analytics available: {app.ANALYTICS_AVAILABLE}")
return app.ANALYTICS_AVAILABLE
else:
print("β ANALYTICS_AVAILABLE not found in app")
return False
except Exception as e:
print(f"β App analytics test failed: {e}")
return False
if __name__ == "__main__":
print("π§ͺ Testing Analytics Fix")
print("=" * 50)
config_ok = test_config_import()
analytics_ok = test_analytics_import()
app_analytics_ok = test_app_analytics()
print("\nπ Results:")
print(f"Config Import: {'β
' if config_ok else 'β'}")
print(f"Analytics Import: {'β
' if analytics_ok else 'β'}")
print(f"App Analytics: {'β
' if app_analytics_ok else 'β'}")
if config_ok and analytics_ok and app_analytics_ok:
print("\nπ All tests passed! Analytics should be working.")
else:
print("\nβ οΈ Some tests failed. Analytics may not be fully functional.") |