add test_ui_deployment
This commit is contained in:
parent
be44e6214a
commit
144089b144
115
cluster4npu_ui/test_ui_deployment.py
Normal file
115
cluster4npu_ui/test_ui_deployment.py
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Test UI deployment dialog without requiring Kneron SDK.
|
||||||
|
This tests the UI deployment flow to verify our fixes work.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
from typing import Dict, Any
|
||||||
|
|
||||||
|
# Add project paths
|
||||||
|
project_root = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
sys.path.insert(0, project_root)
|
||||||
|
|
||||||
|
def create_test_pipeline_data() -> Dict[str, Any]:
|
||||||
|
"""Create a minimal test pipeline that should work."""
|
||||||
|
return {
|
||||||
|
'project_name': 'Test Deployment Pipeline',
|
||||||
|
'description': 'Testing fixed deployment with result handling',
|
||||||
|
'version': '1.0',
|
||||||
|
'nodes': [
|
||||||
|
{
|
||||||
|
'id': 'input_1',
|
||||||
|
'name': 'Camera Input',
|
||||||
|
'type': 'ExactInputNode',
|
||||||
|
'pos': [100, 100],
|
||||||
|
'properties': {
|
||||||
|
'source_type': 'camera', # lowercase to match WorkflowOrchestrator
|
||||||
|
'device_id': 0,
|
||||||
|
'resolution': '640x480',
|
||||||
|
'fps': 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'model_1',
|
||||||
|
'name': 'Test Model',
|
||||||
|
'type': 'ExactModelNode',
|
||||||
|
'pos': [300, 100],
|
||||||
|
'properties': {
|
||||||
|
'model_path': '/path/to/test.nef',
|
||||||
|
'scpu_fw_path': 'fw_scpu.bin',
|
||||||
|
'ncpu_fw_path': 'fw_ncpu.bin',
|
||||||
|
'port_ids': [28, 32],
|
||||||
|
'upload_fw': True
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'output_1',
|
||||||
|
'name': 'Debug Output',
|
||||||
|
'type': 'ExactOutputNode',
|
||||||
|
'pos': [500, 100],
|
||||||
|
'properties': {
|
||||||
|
'output_type': 'console',
|
||||||
|
'destination': './debug_output'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'connections': [
|
||||||
|
{
|
||||||
|
'input_node': 'input_1',
|
||||||
|
'input_port': 'output',
|
||||||
|
'output_node': 'model_1',
|
||||||
|
'output_port': 'input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'input_node': 'model_1',
|
||||||
|
'input_port': 'output',
|
||||||
|
'output_node': 'output_1',
|
||||||
|
'output_port': 'input'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Test the deployment dialog."""
|
||||||
|
print("🧪 TESTING UI DEPLOYMENT DIALOG")
|
||||||
|
print("=" * 50)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Import UI components
|
||||||
|
from ui.dialogs.deployment import DeploymentDialog
|
||||||
|
|
||||||
|
# Create test pipeline data
|
||||||
|
pipeline_data = create_test_pipeline_data()
|
||||||
|
|
||||||
|
print("1. Creating deployment dialog...")
|
||||||
|
dialog = DeploymentDialog(pipeline_data)
|
||||||
|
|
||||||
|
print("2. Showing dialog...")
|
||||||
|
print(" - Click 'Analyze Pipeline' to test configuration")
|
||||||
|
print(" - Click 'Deploy to Dongles' to test deployment")
|
||||||
|
print(" - With our fixes, you should now see result debugging output")
|
||||||
|
print(" - Results should appear in the Live View tab")
|
||||||
|
|
||||||
|
# Show the dialog
|
||||||
|
result = dialog.exec_()
|
||||||
|
|
||||||
|
if result == dialog.Accepted:
|
||||||
|
print("✅ Dialog completed successfully")
|
||||||
|
else:
|
||||||
|
print("❌ Dialog was cancelled")
|
||||||
|
|
||||||
|
except ImportError as e:
|
||||||
|
print(f"❌ Could not import UI components: {e}")
|
||||||
|
print("This test needs to run with PyQt5 available")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"❌ Error testing deployment dialog: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Loading…
x
Reference in New Issue
Block a user