test: 补充 WithEnv 环境变量注入的测试

验证 WithEnv 设置的变量能真正传进子进程,避免上层配置解析漏掉该
字段时无法被发现(此前 framework-v2 里 env 字段一直未接入,线上因
此从未真正生效过)。
This commit is contained in:
2026-07-23 13:48:34 +08:00
parent 983d106166
commit eb6ebd8632
2 changed files with 32 additions and 0 deletions
+6
View File
@@ -31,6 +31,12 @@ def add(a: int, b: int) -> int:
return a + b
@expose
def get_env(name: str) -> str:
"""读取当前进程环境变量,取不到时返回空字符串;用于验证 WithEnv 注入是否生效"""
return os.environ.get(name, "")
@expose
def range_gen(start: int, stop: int) -> Iterator[int]:
"""流式输出:对应 Go 侧 Invoke[chan int]"""