-
Notifications
You must be signed in to change notification settings - Fork 660
[CI] 【Hackathon 9th Sprint No.37】NO.37 功能模块单测补充 #5059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
[CI] 【Hackathon 9th Sprint No.37】NO.37 功能模块单测补充 #5059
Conversation
|
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive unit tests for the fastdeploy/output/token_processor.py module as part of Hackathon 9th Sprint No.37, achieving 82% test coverage through extensive mocking and isolation testing.
Key Changes
- New test file with 23 test methods covering token processing, speculative decoding, metrics tracking, and resource management
- Custom stub modules to isolate token_processor.py from external dependencies (paddle, zmq, etc.)
- Comprehensive test fixtures and helper classes for simulating various processing scenarios
| pass | ||
|
|
||
|
|
||
| def _install_stub_modules(): |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a docstring to explain what this function does and why module stubbing is necessary. For example:
def _install_stub_modules():
"""Install stub/mock modules to isolate the token_processor module for testing.
This creates fake implementations of external dependencies (paddle, zmq, fastdeploy
submodules) to allow testing token_processor.py in isolation without requiring
actual hardware or the full dependency stack.
Returns:
tuple: (main_process_metrics, utils_module) for test inspection
"""| def _install_stub_modules(): | |
| def _install_stub_modules(): | |
| """Install stub/mock modules to isolate the token_processor module for testing. | |
| This creates fake implementations of external dependencies (paddle, zmq, fastdeploy | |
| submodules) to allow testing token_processor.py in isolation without requiring | |
| actual hardware or the full dependency stack. | |
| Returns: | |
| tuple: (main_process_metrics, utils_module) for test inspection | |
| """ |
| @@ -0,0 +1,740 @@ | |||
| from __future__ import annotations | |||
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header. All test files in this repository should include the standard Apache 2.0 copyright header. Please add the following at the beginning of the file:
"""
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""| return _Request(**base) | ||
|
|
||
|
|
||
| class TokenProcessorTestCase(unittest.TestCase): |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a docstring to the test class to describe its purpose. For example:
class TokenProcessorTestCase(unittest.TestCase):
"""Test suite for TokenProcessor class functionality including output processing,
speculative decoding, metrics tracking, and resource management."""| class TokenProcessorTestCase(unittest.TestCase): | |
| class TokenProcessorTestCase(unittest.TestCase): | |
| """Test suite for TokenProcessor class functionality including output processing, | |
| speculative decoding, metrics tracking, and resource management.""" |
| return [] | ||
|
|
||
|
|
||
| class _Request(dict): |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…oy.trace Add trace stubs for token processor tests
Motivation
NO.37 功能模块 fastdeploy/output/token_processor.py 单测补充
Modifications
add tests/output/test_token_processor.py
Usage or Command
tests/output/test_token_processor.py:Accuracy Tests
tests/output/test_token_processor.py: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.