#!/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.")