Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/providers/docker_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ async def run(self, version: str) -> DockerTestResult:
detach=False,
remove=True,
).decode()
data = json.loads(output)

try:
data = json.loads(output)
except json.JSONDecodeError:
data = {
"run": True,
"load": False,
"output": f"插件测试结果解析失败,输出内容非 JSON 格式。\n输出内容:{output}",
}
except Exception as e:
data = {
"run": False,
Expand Down
10 changes: 7 additions & 3 deletions src/providers/docker_test/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,15 @@ async def run(self):
# 补上获取到 Python 版本
self._test_env.insert(0, f"python=={self._test_python_version}")
# 读取插件元数据
metadata = None
metadata_path = self._test_dir / "metadata.json"
metadata = None
if metadata_path.exists():
with open(self._test_dir / "metadata.json", encoding="utf-8") as f:
metadata = json.load(f)
try:
metadata = json.loads(metadata_path.read_text(encoding="utf-8"))
except json.JSONDecodeError:
self._log_output("插件元数据读取失败,metadata.json 格式不正确。")
except Exception as e:
self._log_output(f"插件元数据读取失败,错误信息:{e}")

result = {
"metadata": metadata,
Expand Down
Loading