[CI]【Hackathon 10th Spring No.36】worker_process unit test#7324
Open
r-cloudforge wants to merge 18 commits intoPaddlePaddle:developfrom
Open
[CI]【Hackathon 10th Spring No.36】worker_process unit test#7324r-cloudforge wants to merge 18 commits intoPaddlePaddle:developfrom
r-cloudforge wants to merge 18 commits intoPaddlePaddle:developfrom
Conversation
…lat structure, 80% coverage - Flatten class-based tests to flat pytest functions (32→25 tests) - Add _run_eplb enabled path (token stats + weight update + value=None) - Add initialize_fd_config EP branch + quant_config branch - Add kv_cache cap at 40000, graph_optimize splitwise path - Add run_worker_proc with deterministic mode + iluvatar dispatch - Coverage: 69% → 80% (395/493 stmts)
Add test cases for: - EP config with int moe_num_experts (else branch) - Non-CUDA/XPU platform V1 scheduler fallback - v1_loader_support fallback to default - PaddleOCR architecture branch - num_hidden_layers=None ValueError
- Replace 33 MagicMock instances with types.SimpleNamespace, real numpy arrays, and real callables (lambda/async def) - Remove unittest.mock.MagicMock and AsyncMock imports - Keep only unittest.mock.patch for module-level substitution - All 21 tests pass, coverage unchanged at 80%
…vcache lock, eplb elif — delta 122→152
Per reviewer @CSWYF3634076 feedback: - Keep all tests in unittest.TestCase classes - Minimize mock content, use real logic - Two classes: TestWorkerUtils (real logic) + TestPaddleDisWorkerProc - Removed MagicMock entirely (83 → 0 references) - Reduced patch usage (was excessive, now 35 targeted patches)
Address 3 Copilot review comments: 1. Fix double space in copyright header 2. Add # fmt: on to close the # fmt: off block after _cfg() 3. Use assertEqual instead of assertIs for integer comparison
…ker-process-test # Conflicts: # tests/worker/test_worker_process.py
|
Thanks for your contribution! |
|
cloudforge1 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
fastdeploy-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-11 04:07 CST
📋 Review 摘要
PR 概述:为 fastdeploy/worker/worker_process.py 补充单元测试,覆盖率从 61% 提升至 97%
变更范围:新增 tests/worker/test_worker_process.py 单元测试文件
影响面 Tag:[CI]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| - | - | 未发现阻塞性问题 |
总体评价
这是一个高质量的单测 PR。测试设计合理,Mock 使用恰当,覆盖率提升显著(61% → 97%,贡献约 152 行覆盖)。测试代码覆盖了核心功能、边界场景和异常处理,包括多平台分发、KV Cache 初始化、EPLB 配置、控制方法执行等关键逻辑。
对于少数未覆盖的复杂场景(如 nnode > 1、data_parallel_size > 1 等),由于测试难度较高且影响有限,当前覆盖率已非常出色。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
No.36 功能模块 fastdeploy/worker/worker_process.py 单测补充
Modifications
add unittest tests/worker/test_worker_process.py
develop 分支:覆盖率61%,Miss行数169(85-87, 92-111, 134, 193-209, 300-314, 317-320, 332-385, 399-436, 452-453, 464-465, 486-488, 496->505, 500, 508-558, 568, 575, 582-585, 606-608, 620, 660, 683, 693-699, 713, 740-763, 1126-1127, 1132-1143, 1170, 1205-1206, 1234, 1259-1261, 1273-1277)
当前PR:覆盖率97%,Miss行数17
完成单测覆盖行数 169-17 = 152 → 四舍五入 200 → 预估贡献度 0.2⭐
Usage or Command
Accuracy Tests
no need
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.