Prhub

#50241 [CI][Test] Fix pooling truncation test after VLLMError hierarchy change

原始 PR 作者 stefankoncarevic 合并时间 2026-07-29 20:15 文件变更 1 提交数 1 评论 1 代码增减 +3 / -1

执行摘要

修复 pooling truncation 测试异常类型不匹配

PR body 明确指出:tests/models/language/pooling/test_truncation_control.py::test_bigger_truncation_sizemain 分支上开始失败。原因是请求校验路径现在抛出 VLLMValidationError,它不再是 ValueError 的子类,因此 pytest.raises(ValueError) 无法捕获异常,导致测试失败。

简单但必要的测试修复,值得快速合入以恢复 CI 稳定性。关注 PR #49665 引入的异常层次变化,确认其他类似测试是否需要同步调整。

讨论亮点

无实质性讨论;维护者 noooop 直接批准合并。

实现拆解

  1. 导入新增:在测试文件头部添加 from vllm.exceptions import VLLMValidationError
  2. 异常类型替换:将 pytest.raises(ValueError) 改为 pytest.raises(VLLMValidationError)
  3. 不涉及其他修改:仅改动该测试文件的 2 处,不影响任何源码逻辑。
文件 模块 状态 重要度
tests/models/language/pooling/test_truncation_control.py 测试 modified 3.97

关键源码片段

tests/models/language/pooling/test_truncation_control.py test-coverage

唯一的变更文件,修复了因异常层次变更导致的测试失败。

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import pytest# 新增导入:VLLMValidationError 是 PR #49665 引入的新异常类型,
# 它继承自 VLLMClientError 而非 ValueError
from vllm.exceptions import VLLMValidationError...def test_bigger_truncation_size(
    vllm_runner, model_name=MODEL_NAME, input_str=input_str
):
    truncate_prompt_tokens = max_model_len + 1
​
    with (
        # 修复前:pytest.raises(ValueError) 无法捕获新异常
        # 修复后:使用 pytest.raises(VLLMValidationError)
        pytest.raises(VLLMValidationError),
        vllm_runner(
            model_name, runner="pooling", max_model_len=max_model_len
        ) as vllm_model,
    ):
        llm_output = vllm_model.llm.embed(
            input_str,
            tokenization_kwargs=dict(truncate_prompt_tokens=truncate_prompt_tokens),
        )
        ...

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

风险极低。变更仅涉及测试文件中异常期望类型的修正,不改变任何生产代码逻辑。但需注意,若未来异常层次再次变更,该测试仍需同步更新。

影响范围仅限于单个测试用例的通过性。修复后 ROCm CI 的 Language Models Test (Extended Pooling) 步骤恢复绿色。对其他平台无影响。

仅测试修复 低风险

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论