Skip to content

Commit

Permalink
fix: 插件测试时设置为 10 分钟超时 (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Apr 16, 2024
1 parent b00fbdb commit c854700
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/
### Fixed

- 修复指定 key 时无法正确读取配置的问题
- 插件测试时设置为 10 分钟超时

## [3.2.4] - 2024-02-04

Expand Down
25 changes: 16 additions & 9 deletions src/utils/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""
# ruff: noqa: T201, ASYNC101

import asyncio
import json
import os
import re
Expand Down Expand Up @@ -297,15 +298,21 @@ async def run_poetry_project(self) -> None:
)
)

proc = await create_subprocess_shell(
"poetry run python runner.py",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=self.path,
env=self.get_env(),
)
stdout, stderr = await proc.communicate()
code = proc.returncode
try:
proc = await create_subprocess_shell(
"poetry run python runner.py",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=self.path,
env=self.get_env(),
)
stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=600)
code = proc.returncode
except asyncio.TimeoutError:
proc.terminate()
stdout = b""
stderr = "测试超时".encode()
code = 1

self._run = not code

Expand Down

0 comments on commit c854700

Please sign in to comment.