| |
| """ |
| Test script to verify analytics are loading after config fix |
| """ |
|
|
| import sys |
| import os |
|
|
| |
| 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 frontend.app as app |
| |
| |
| 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.") |