#!/usr/bin/env python3 """Test that the engine module can be imported without errors.""" import sys import os import traceback def test_engine_import(): """Test that the engine module imports without errors.""" errors = [] try: # Add the tools directory to the path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # Import the engine module import engine print(f"✓ Engine module imported successfully") # Check for common runtime errors if not hasattr(engine, 'GameEngine'): errors.append("GameEngine class not found") else: print(f"✓ GameEngine class found") # Check that generate_with_tools_single exists if hasattr(engine.GameEngine, 'generate_with_tools_single'): print(f"✓ generate_with_tools_single method found") else: errors.append("generate_with_tools_single method not found") except ImportError as e: errors.append(f"Import error: {e}") except AttributeError as e: errors.append(f"Attribute error: {e}") except Exception as e: errors.append(f"Unexpected error: {e}\n{traceback.format_exc()}") return errors if __name__ == '__main__': errors = test_engine_import() if errors: print("ERROR: Runtime errors detected:") for error in errors: print(f" - {error}") sys.exit(1) else: sys.exit(0)