Skip to content

Commit

Permalink
fix(plugin_test): 修复插件元数据不合法时 metadata.json 为空的问题 (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Nov 20, 2024
1 parent c4d723f commit db792b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

## [Unreleased]

### Fixed

- 修复插件元数据不合法时 metadata.json 为空的问题

## [4.0.8] - 2024-11-20

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion src/providers/docker_test/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def default(self, o):
"supported_adapters": plugin.metadata.supported_adapters,
}}
with open("metadata.json", "w", encoding="utf-8") as f:
f.write(f"{{json.dumps(metadata, cls=SetEncoder)}}")
try:
f.write(f"{{json.dumps(metadata, cls=SetEncoder)}}")
except Exception:
f.write("{{}}")
if plugin.metadata.config and not issubclass(plugin.metadata.config, BaseModel):
logger.error("插件配置项不是 Pydantic BaseModel 的子类")
Expand Down

0 comments on commit db792b6

Please sign in to comment.