Skip to content

Commit 6804189

Browse files
authored
fix: 修复插件测试报错的 ctx 异常的问题 (#257)
1 parent 7774dfd commit 6804189

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/providers/validation/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def plugin_test_load_validator(cls, v: bool, info: ValidationInfo) -> bool:
274274
raise PydanticCustomError(
275275
"plugin.test",
276276
"插件无法正常加载",
277-
{"output": context.get("plugin_test_output")},
277+
{"output": context.get("test_output")},
278278
)
279279

280280
@field_validator("metadata", mode="before")

tests/utils/store_test/test_validate_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,12 @@ async def test_validate_plugin_failed_with_previous(
411411
"loc": ("load",),
412412
"msg": "插件无法正常加载",
413413
"input": False,
414-
"ctx": {"output": None},
414+
"ctx": {
415+
"output": """\
416+
创建测试目录 plugin_test
417+
For further information visit https://errors.pydantic.dev/2.9/v/model_type\x1b[0m\
418+
"""
419+
},
415420
},
416421
],
417422
},

tests/utils/validation/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ async def test_plugin_info_validation_plugin_load_failed(
154154
"loc": ("load",),
155155
"msg": "插件无法正常加载",
156156
"input": False,
157-
"ctx": {"output": None},
157+
"ctx": {"output": "test_output"},
158158
}
159159
],
160160
info=None,

0 commit comments

Comments
 (0)