#!/usr/bin/env python3 """ Test script to verify the revamped UI and export features """ import os import sys import subprocess import time import threading from pathlib import Path def test_dependencies(): """Test that all required dependencies are installed""" print("Testing dependencies...") try: import customtkinter print("[OK] customtkinter installed") except ImportError: print("[FAIL] customtkinter not installed") return False try: import pandas print("[OK] pandas installed") except ImportError: print("[FAIL] pandas not installed") return False try: import openpyxl print("[OK] openpyxl installed") except ImportError: print("[FAIL] openpyxl not installed") return False try: import sqlalchemy print("[OK] sqlalchemy installed") except ImportError: print("[FAIL] sqlalchemy not installed") return False try: import bcrypt print("[OK] bcrypt installed") except ImportError: print("[FAIL] bcrypt not installed") return False return True def test_exports(): """Test Excel export functionality""" print("\nTesting Excel export functionality...") # Import and run the existing test_export.py try: from test_export import test_excel_exports test_excel_exports() print("[OK] All Excel export tests passed") return True except Exception as e: print(f"[FAIL] Excel export tests failed: {e}") return False def test_ui_startup(): """Test that the UI can start without errors""" print("\nTesting UI startup...") try: # Test that we can import the main modules from src.app import ManufacturingApp from src.ui.main_window import MainWindow print("[OK] All UI modules import successfully") # Test database initialization from src.database import DatabaseManager db_manager = DatabaseManager() db_manager.initialize_database() print("[OK] Database initialization successful") return True except Exception as e: print(f"✗ UI startup test failed: {e}") return False def main(): """Run all tests""" print("=== Testing Revamped Manufacturing App ===\n") success = True success &= test_dependencies() success &= test_ui_startup() success &= test_exports() if success: print("\n[SUCCESS] All tests passed! The revamped UI and export features are working correctly.") else: print("\n[ERROR] Some tests failed. Please check the output above.") return success if __name__ == "__main__": success = main() sys.exit(0 if success else 1)