Files
potaserandClaude Fable 5 cb3732dc71 轻量拓展分析支持上游样本继承:同job内成功运行产物自动预填下游输入槽
- 新增 upstream.py:枚举 workspace/<job>/extension_runs/*/runtime_*/outputs 的成功产物,
  按 basename 精确匹配优先、role 关键词辅助(多命中取最新 run)收敛为每槽一个候选
- 新增 GET /api/lightweight-extension-stages/{id}/upstream-candidates?job_id= 端点,
  返回 workspace 相对形式的候选与来源信息;仅对契约 patch_targets 可补丁槽位启用改名匹配,
  不可补丁槽位留空由用户手填,避免 PATCH_TARGET_UNAVAILABLE
- 前端运行向导:LLM slots 之后对空槽填充上游候选并显示绿色来源标记(可修改),
  用户手动上传/导入时清除来源标记
- runtime_binding 支持目录输入:_resolve_inputs/_job_path 放宽目录,
  物化走 copy_tree 整树拷贝 + _sha256_tree 目录摘要校验,isolate 跳过独立副本
- nl_intent prompt 规则 4 追加 extension_runs 上游产物引用指引
- 新增 20+ 单测覆盖上游发现/端点/目录输入/前端契约

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-01 20:26:00 +08:00
..
2026-08-09 04:32:28 +08:00
2026-08-03 18:42:47 +08:00
2026-08-03 18:42:47 +08:00
2026-08-03 18:42:47 +08:00
2026-08-03 18:42:47 +08:00
2026-08-03 18:42:47 +08:00
2026-08-03 18:42:47 +08:00

BBAV20311 测试套件

测试结构

tests/
├── conftest.py              # pytest配置和fixture
├── unit/                    # 单元测试
│   ├── agents/
│   │   └── test_router.py   # RouterAgent测试
│   └── skills/
│       └── test_gene_identify.py  # 技能测试
├── integration/             # 集成测试
│   └── test_agent_flow.py   # Agent协作流程
├── e2e/                     # 端到端测试
│   └── test_api.py          # API测试
└── fixtures/                # 测试数据

运行测试

安装依赖

pip install -r requirements-test.txt

运行所有测试

./run_tests.sh

运行特定测试

# autofill 入口回归检查;不依赖 pytest,适合当前 test4py311 环境
/home/xia-lab/miniconda3/envs/test4py311/bin/python scripts/check_autofill_regression.py

# subfamily review 证据图 scope/manifest 回归检查
/home/xia-lab/miniconda3/envs/test4py311/bin/python scripts/check_subfamily_evidence_scope.py

# 单元测试
pytest tests/unit -v

# 集成测试
pytest tests/integration -v

# E2E测试(需要服务运行)
pytest tests/e2e -v

# 带覆盖率
pytest tests/ --cov=gfa_core --cov-report=html

测试类型

类型 速度 范围 命令
单元测试 快(<1s) 单个函数/类 pytest tests/unit
集成测试 中(<10s) 模块协作 pytest tests/integration
E2E测试 慢(<5min) 完整流程 pytest tests/e2e

编写新测试

单元测试示例

import pytest
from gfa_core.mas.agents.router import RouterAgent

@pytest.mark.unit
class TestRouterAgent:
    def test_initialization(self):
        agent = RouterAgent(mock_llm)
        assert agent.name == "router"

集成测试示例

import pytest

@pytest.mark.integration
class TestAgentFlow:
    @pytest.mark.asyncio
    async def test_full_flow(self):
        # 测试完整流程
        pass

测试覆盖率目标

  • 单元测试: >80%
  • 集成测试: 核心流程覆盖
  • E2E测试: 关键用户场景