Skip to content

[CI]【Hackathon 10th Spring No.36】worker_process 单测补充#6736

Open
cloudforge1 wants to merge 8 commits intoPaddlePaddle:developfrom
cloudforge1:task/h10-036-worker-process-test
Open

[CI]【Hackathon 10th Spring No.36】worker_process 单测补充#6736
cloudforge1 wants to merge 8 commits intoPaddlePaddle:developfrom
cloudforge1:task/h10-036-worker-process-test

Conversation

@cloudforge1
Copy link
Contributor

@cloudforge1 cloudforge1 commented Mar 9, 2026

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

注:截图为本测试文件单独运行的 pytest --cov 输出(含 branch coverage),上方文字为 develop 已有测试与本 PR 合并后的 statement 覆盖率预估值,两者统计口径不同,以 CI 合并后实际值为准。

完成单测覆盖行数 169-17 = 152 → 四舍五入 200 → 预估贡献度 0.2⭐

Usage or Command

pytest tests/worker/test_worker_process.py

Accuracy Tests

no need

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[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]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link

paddle-bot bot commented Mar 9, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Mar 9, 2026
@cloudforge1 cloudforge1 marked this pull request as draft March 9, 2026 14:50
@cloudforge1 cloudforge1 force-pushed the task/h10-036-worker-process-test branch from 3162a1f to a39c57e Compare March 9, 2026 16:30
@cloudforge1 cloudforge1 force-pushed the task/h10-036-worker-process-test branch from a39c57e to 9b0b166 Compare March 9, 2026 16:39
@cloudforge1 cloudforge1 changed the title [Tests]【Hackathon 10th Spring No.36】add unit tests for worker/worker_process.py [CI]【Hackathon 10th Spring No.36】worker_process 单测补充 Mar 9, 2026
@cloudforge1 cloudforge1 marked this pull request as ready for review March 9, 2026 16:49
@cloudforge1 cloudforge1 marked this pull request as draft March 9, 2026 17:25
@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@d73fd87). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #6736   +/-   ##
==========================================
  Coverage           ?   73.34%           
==========================================
  Files              ?      399           
  Lines              ?    55620           
  Branches           ?     8766           
==========================================
  Hits               ?    40792           
  Misses             ?    11960           
  Partials           ?     2868           
Flag Coverage Δ
GPU 73.34% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…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
@cloudforge1 cloudforge1 force-pushed the task/h10-036-worker-process-test branch from 906e312 to 6022842 Compare March 12, 2026 16:13
- 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%
@cloudforge1 cloudforge1 marked this pull request as ready for review March 13, 2026 13:28
@cloudforge1
Copy link
Contributor Author

@luotao1 @CSWYF3634076 请review,谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants