fix(exchange,case_validator),refactor(),feat(model): 解决 Pydantic 模型初始化与变量占位符的类型冲突,优化变量替换逻辑,重构 CaseInfo 模型并引入延迟校验机制
- 引入 SmartInt 和 SmartDict 类型,支持 YAML 占位符与业务类型的自动转换。 - 优化 CaseInfo 互斥校验逻辑,确保 request 与 api_action 二选一。 - 统一使用 Pydantic V2 的 model_config 规范。 - 将变量替换时机提前至模型实例化之前,支持占位符在校验前完成真实值注入, 保证了 int/bool 等字段的类型转换正确性。 - 优化断言渲染时机,支持响应提取值关联。
This commit is contained in:
38
conftest.py
Normal file
38
conftest.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
|
||||
"""
|
||||
@desc: Pytest 配置文件,用于设置全局 Fixture 和钩子函数
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
import logging
|
||||
|
||||
from core import settings
|
||||
from commons.files import YamlFile
|
||||
from core.models import CaseInfo
|
||||
from core.session import Session
|
||||
from core.exchange import Exchange
|
||||
from core.settings import EXTRACT_CACHE
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def session():
|
||||
"""全局共享的 Session Fixture"""
|
||||
return Session(settings.base_url)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def exchanger():
|
||||
"""全局共享的 Exchange Fixture"""
|
||||
return Exchange(EXTRACT_CACHE)
|
||||
|
||||
|
||||
# @pytest.fixture(scope="session")
|
||||
# def case_engine(session, exchanger):
|
||||
# """全局共享的 CaseEngine Fixture"""
|
||||
# return CaseEngine(session, exchanger)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user