40f641611b
1. 将CliRunner默认执行策略从sequential改为dependency 2. 新增RunReport的任务状态查询和时长统计方法 3. 实现task装饰器并补充executor参数文档 4. 新增进程池执行器支持CPU密集型任务 5. 新增Graph.chain链式构建和add_subgraph子图合并功能 6. 新增流式任务传递、进程池执行、命名空间等多类测试用例 7. 补充tests目录路径导入配置
24 lines
752 B
Python
24 lines
752 B
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
# 将 tests 目录加入 sys.path,使进程池测试能 import _proc_helper 模块级辅助函数。
|
|
# 进程池 pickle 要求被调用函数为模块级,conftest.py 在 xdist worker 中也会执行。
|
|
_TESTS_DIR = str(Path(__file__).resolve().parent)
|
|
if _TESTS_DIR not in sys.path:
|
|
sys.path.insert(0, _TESTS_DIR)
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def packtool_tmp_workdir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
"""自动切换到临时工作目录,防止测试污染项目根目录.
|
|
|
|
Args:
|
|
tmp_path: pytest 提供的临时目录
|
|
monkeypatch: pytest 的 monkeypatch 工具
|
|
"""
|
|
monkeypatch.chdir(tmp_path)
|