compliance/test_orchestrator_init.py
2025-08-19 17:09:11 +08:00

74 lines
2.4 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
测试APITestOrchestrator初始化的脚本
"""
import sys
import logging
from ddms_compliance_suite.test_orchestrator import APITestOrchestrator
def test_orchestrator_initialization():
"""测试APITestOrchestrator的初始化"""
# 设置日志
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
logger.info("开始测试APITestOrchestrator初始化...")
try:
# 初始化编排器
orchestrator = APITestOrchestrator(
base_url="https://www.dev.ideas.cnpc",
strictness_level="CRITICAL",
ignore_ssl=True,
enable_well_data=True
)
# 检查关键属性是否正确初始化
logger.info("✅ APITestOrchestrator初始化成功")
# 检查strictness_level属性
if hasattr(orchestrator, 'strictness_level'):
logger.info(f"✅ strictness_level属性存在: {orchestrator.strictness_level}")
else:
logger.error("❌ strictness_level属性不存在")
return False
# 检查井数据管理器
if hasattr(orchestrator, 'well_data_manager'):
if orchestrator.well_data_manager:
logger.info("✅ 井数据管理器已初始化")
else:
logger.info(" 井数据管理器未启用")
else:
logger.error("❌ well_data_manager属性不存在")
return False
# 检查其他关键属性
required_attrs = [
'base_url', 'api_caller', 'test_case_registry',
'global_api_call_details', 'ignore_ssl', 'llm_config',
'output_dir_path', 'schema_cache', 'parser'
]
for attr in required_attrs:
if hasattr(orchestrator, attr):
logger.info(f"{attr}属性存在")
else:
logger.error(f"{attr}属性不存在")
return False
logger.info("🎉 所有属性检查通过")
return True
except Exception as e:
logger.error(f"❌ APITestOrchestrator初始化失败: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = test_orchestrator_initialization()
sys.exit(0 if success else 1)