test: 完善多份测试用例的类型标注与校验逻辑
1. 为多个测试函数补充pytest.CaptureFixture[str]类型注解 2. 为graphlib类型声明文件补全方法参数类型 3. 为pdftool测试的mock函数添加Any类型标注 4. 新增数据库连接非空校验断言 5. 优化emlmanager测试的字典展开格式与修复decode测试bug 6. 为gittool测试添加命令类型列表校验 7. 为envrs测试添加pyrefly忽略注释
This commit is contained in:
@@ -54,7 +54,7 @@ def test_verbose_event_callback_running():
|
||||
assert report.success
|
||||
|
||||
|
||||
def test_verbose_run_with_success_lifecycle(capsys):
|
||||
def test_verbose_run_with_success_lifecycle(capsys: pytest.CaptureFixture[str]):
|
||||
"""Test px.run with verbose=True prints SUCCESS lifecycle."""
|
||||
spec = px.TaskSpec("test", fn=lambda: "result")
|
||||
graph = px.Graph.from_specs([spec])
|
||||
@@ -64,7 +64,7 @@ def test_verbose_run_with_success_lifecycle(capsys):
|
||||
assert "成功" in captured.out
|
||||
|
||||
|
||||
def test_verbose_run_with_failed_lifecycle(capsys):
|
||||
def test_verbose_run_with_failed_lifecycle(capsys: pytest.CaptureFixture[str]):
|
||||
"""Test px.run with verbose=True prints FAILED lifecycle with error."""
|
||||
|
||||
def raise_error():
|
||||
@@ -80,7 +80,7 @@ def test_verbose_run_with_failed_lifecycle(capsys):
|
||||
assert "test error" in captured.out
|
||||
|
||||
|
||||
def test_verbose_run_with_skipped_lifecycle(capsys):
|
||||
def test_verbose_run_with_skipped_lifecycle(capsys: pytest.CaptureFixture[str]):
|
||||
"""Test px.run with verbose=True prints SKIPPED lifecycle."""
|
||||
spec = px.TaskSpec(
|
||||
"test",
|
||||
@@ -98,7 +98,7 @@ def test_verbose_run_with_user_callback():
|
||||
"""Test px.run with verbose=True and user callback both called."""
|
||||
events = []
|
||||
|
||||
def on_event(event):
|
||||
def on_event(event: px.TaskEvent):
|
||||
events.append(event)
|
||||
|
||||
spec = px.TaskSpec("test", fn=lambda: "result")
|
||||
|
||||
Reference in New Issue
Block a user