#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 逐个测试模型初始化 """ import sys import os # 添加项目根目录到Python路径 sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) def test_models_one_by_one(): print("开始逐个测试模型初始化...") print("1. 测试MonitorModel...") from models.monitor_model import MonitorModel monitor_model = MonitorModel() print("✓ MonitorModel初始化成功") print("2. 测试SampleModel...") from models.sample_model import SampleModel sample_model = SampleModel() print("✓ SampleModel初始化成功") print("3. 测试DUTModel...") from models.dut_model import DUTModel dut_model = DUTModel() print("✓ DUTModel初始化成功") print("4. 测试SystemModel...") from models.system_model import SystemModel system_model = SystemModel() print("✓ SystemModel初始化成功") print("所有模型测试完成!") if __name__ == '__main__': try: test_models_one_by_one() except Exception as e: print(f"发生错误: {e}") import traceback traceback.print_exc()