refactor(tests): optimize unit test structure

This commit is contained in:
chengyongru
2026-03-24 15:12:22 +08:00
committed by Xubin Ren
parent d25985be0b
commit 72acba5d27
52 changed files with 104 additions and 13 deletions
+6 -4
View File
@@ -3,6 +3,7 @@
import asyncio
import os
import re
import sys
from pathlib import Path
from typing import Any
@@ -113,10 +114,11 @@ class ExecTool(Tool):
except asyncio.TimeoutError:
pass
finally:
try:
os.waitpid(process.pid, os.WNOHANG)
except (ProcessLookupError, ChildProcessError) as e:
logger.debug("Process already reaped or not found: {}", e)
if sys.platform != "win32":
try:
os.waitpid(process.pid, os.WNOHANG)
except (ProcessLookupError, ChildProcessError) as e:
logger.debug("Process already reaped or not found: {}", e)
return f"Error: Command timed out after {effective_timeout} seconds"
output_parts = []