fix: 完善 UT 覆盖,统一 pytest 测试发现 - Closes #2
CI / test (pull_request) Successful in 9s

- 新建 pytest.ini 统一 test discovery(tests/ + skills/ir_generation_skill/tests/)
- test_step1~3 转换为 pytest 兼容格式,无输出文件时自动 skip
- 新增 tests/test_detect_conflicts.py(18 个纯函数单测)
- 新增 tests/test_config.py(7 个配置模块单测)
- CI 改为 pytest -v 使用 pytest.ini testpaths
- DEV_AGENT.md 新增 PR 提交规范

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 00:07:07 +08:00
parent 618364e744
commit 682dedb4b4
11 changed files with 619 additions and 32 deletions
+40 -11
View File
@@ -83,7 +83,7 @@ python scripts/agent_poller.py --action get --issue N
1. git pull origin main
2. git checkout -b dev/issue-N-<slug>
3. 修改功能代码 + 更新/补充 UT 和接口集成测试
4. python -m pytest tests/ -v # 本地全量测试
4. python -m pytest -v # 本地全量测试
5. git commit -m "fix: <描述> - Closes #N"
6. git push origin dev/issue-N-<slug>
```
@@ -94,14 +94,42 @@ python scripts/agent_poller.py --action get --issue N
- 关注 IR 一致性:对同一输入的多次运行结果应尽量稳定
- 关注功能覆盖率:确保 IR 覆盖了输入文档中的功能点
### 4. 等待 CI
### 4. 提交 PR
Push 后 CI 自动运行。可通过 Gitea Actions 页面或 `agent_poller.py` 查看状态。
Push 后立即创建 PR(每个 Issue 对应一个 PR):
### 5. 处理结果
```bash
gh pr create \
--title "fix: <描述> - Closes #N" \
--body "$(cat <<'EOF'
## Summary
- <改动摘要>
- **CI 通过**:创建 PR 合并到 main(或直接 push 到 main),`Closes #N` 自动关闭 Issue
- **CI 失败**:CI 自动创建新 Issue,分析失败原因,进入下一轮修复
## Test
- [ ] pytest 全量通过
- [ ] UT / 集成测试已更新
Closes #N
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
```
### 5. 等待 CI
PR 创建后 CI 自动触发。可通过 Gitea Actions 页面或 `gh pr checks` 查看状态。
### 6. 处理结果
- **CI 通过**
1. Merge PR 到 main`gh pr merge <PR-URL> --merge`
2. 在 Issue 中评论 PR 信息和合并结果
3. `Closes #N` 自动关闭 Issue
- **CI 失败**
1. CI 自动创建 `ci-failure` Issue
2. 分析失败原因,在 PR 上 push 修复 commit
3. CI 重新触发,直到通过
## 闭环
@@ -110,16 +138,17 @@ QE-Agent 开 Issue (qe-feedback)
Dev-Agent 分析 → 开发/重构 → 更新测试
git push → CI (lint + pytest + acceptance)
git push → 创建 PR → CI (pytest)
┌─ 失败 → 自动开 Issue → 回到开头
┌─ 失败 → 自动开 Issue → push 修复 → 回到 CI
└─ 成功 → Issue 关闭 → QE-Agent 验证 → 新反馈
└─ 成功 → Merge PR → 评论 Issue 关闭 → QE-Agent 验证 → 新反馈
```
## 提交规范
- **格式**`fix: <简短描述> - Closes #N``feat: <描述> - Closes #N`
- **粒度**:一个 commit 对应一个 Issue
- **测试**:每次提交必须确保 `pytest tests/ -v` 全量通过
- **粒度**:一个 Issue → 一个分支 → 一个 PR → 一个 commit
- **测试**:每次提交必须确保 `python -m pytest -v` 全量通过
- **范围**:不混入与当前 Issue 无关的改动
- **PR**Push 后立即创建 PRCI 通过后 mergePR 信息写入 Issue 后关闭