[CI] Add unittest Claude skill and supplement unit test coverage#7888
[CI] Add unittest Claude skill and supplement unit test coverage#7888EmmonsCurse wants to merge 1 commit into
Conversation
|
Thanks for your contribution! |
|
/skip-ci ci_iluvatar |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-22 00:10:01
📋 Review 摘要
PR 概述:新增 FastDeploy 单测生成 Claude Skill,清理 entrypoints 下的临时测试脚本,并为 33+ 个模块补充 unit test 覆盖。
变更范围:.claude/skills/(新增 skill 文档)、fastdeploy/entrypoints/(删除临时脚本)、tests/(新增测试)
影响面 Tag:[CI]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | tests/cache_manager/test_file_store.py |
test_clear_refuses_dangerous_paths 方法内存在冗余的 with patch(logger) |
| ❓ 疑问 | tests/cache_manager/test_file_store.py |
纯逻辑测试类中直接调用 paddle.to_tensor() 未标记 @pytest.mark.gpu |
🟡 建议 — 冗余 patch
TestFileStoreClear.test_clear_refuses_dangerous_paths 方法已通过 @patch("...logger") 装饰器注入 mock_logger,但方法体内部又嵌套了一个 with patch("...logger"): 上下文管理器,对同一目标重复 patch,冗余代码建议删除。
❓ 疑问 — paddle.to_tensor 未标注 GPU
TestFileStoreOperations.test_get_invalid_target_size 和 test_get_success 两个方法在 mock 路径内调用了 paddle.to_tensor(...)。该调用在没有 GPU 的环境下可能触发 CUDA 初始化异常。由于这两个方法所在的测试类属于 Pattern 1(纯逻辑),建议确认:是否可用 MagicMock() 替代 paddle.to_tensor() 的返回值,避免引入隐式 GPU 依赖?若确认 CI 始终有 GPU 可跳过此项。
📝 PR 规范检查
PR 标题包含官方 Tag [CI] ✓;描述含 ## Motivation、## Modifications、## Usage or Command(N/A)、## Accuracy Tests(N/A)、## Checklist 五个必填段落,结构完整 ✓;Checklist 勾选状态与 diff 实际情况吻合(新增测试 ✓、pre-commit ✓,精度测试 N/A)✓。PR 规范合规,无需修改。
总体评价
变更整体质量较高:Skill 文档完善(覆盖 4 种测试模式、CI 分类规则、端口管理等),新增测试结构规范、mocking 合理、setUp/tearDown 资源清理完善;删除 test_openai.py 脚本也是正确做法(该文件硬编码了 IP 和端口,属于手动验证脚本不宜放在源码目录)。两处建议均不阻塞合入。
CI报告基于以下代码生成(30分钟更新一次): 1 任务总览当前 Required CI 未通过:存在 1 个 required 失败任务,0 个 required 运行中/等待中任务。需优先处理单测失败后再合入。
2 任务状态汇总日志列说明:失败任务直接使用 CI 日志链接;可选任务失败不阻塞合并,仅供参考。 2.1 Required任务 : 2/10 通过
2.2 可选任务 — 26/31 通过
3 失败详情(仅 required)Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage — 测试失败(置信度: 高)Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage
失败用例:
根因详情: 关键日志: 修复建议:
修复建议摘要: 补齐 create_kv_cache mock 返回 关联变更: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7888 +/- ##
==========================================
Coverage ? 76.46%
==========================================
Files ? 398
Lines ? 56276
Branches ? 8804
==========================================
Hits ? 43032
Misses ? 10450
Partials ? 2794
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation
To improve unit test development efficiency and standardization, a dedicated Claude skill for FastDeploy unittest generation is introduced. In addition, related unit tests need to be supplemented to improve test coverage and validation completeness.
Modifications
Usage or Command
N/A
Accuracy Tests
N/A
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.