[MyPy][2/N] Fix mypy errors in small tests/ dirs (#51043)

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Hickey
2026-09-29 21:27:45 +01:00
committed by GitHub
co-authored by Harry Mellor Claude Opus 5.5
parent a96ee5935d
commit 5dd693122c
71 changed files with 491 additions and 301 deletions
@@ -285,7 +285,7 @@ def test_async_tp_pass_requires_full_graph_compilation():
]
async_tp_pass = object.__new__(AsyncTPPass)
async_tp_pass.compilation_config = vllm_config.compilation_config
async_tp_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment]
with pytest.raises(
AssertionError, match="AsyncTPPass requires full-graph compilation"
@@ -111,7 +111,7 @@ def test_fused_ar_workspace_hidden_dim(
target_hidden: int, draft_hidden: int | None, expected: int
):
config = _make_workspace_hidden_config(target_hidden, draft_hidden)
assert _fused_ar_workspace_hidden_dim(config) == expected
assert _fused_ar_workspace_hidden_dim(config) == expected # type: ignore[arg-type]
def test_fused_ar_workspace_hidden_dim_spec_without_draft():
@@ -120,7 +120,7 @@ def test_fused_ar_workspace_hidden_dim_spec_without_draft():
model_config=SimpleNamespace(get_hidden_size=lambda: 2048),
speculative_config=SimpleNamespace(draft_model_config=None),
)
assert _fused_ar_workspace_hidden_dim(config) == 2048
assert _fused_ar_workspace_hidden_dim(config) == 2048 # type: ignore[arg-type]
class TestAllReduceRMSNormModel(torch.nn.Module):
@@ -222,7 +222,7 @@ def test_sequence_parallelism_pass_requires_full_graph_compilation():
]
sequence_parallelism_pass = object.__new__(SequenceParallelismPass)
sequence_parallelism_pass.compilation_config = vllm_config.compilation_config
sequence_parallelism_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment]
sequence_parallelism_pass.min_token_num = 1
with pytest.raises(
+3 -1
View File
@@ -33,6 +33,7 @@ from vllm.config import (
VllmConfig,
set_current_vllm_config,
)
from vllm.config.cache import CacheDType
from vllm.forward_context import get_forward_context, set_forward_context
from vllm.model_executor.layers.attention import Attention
from vllm.model_executor.layers.quantization.utils.quant_utils import (
@@ -198,6 +199,7 @@ class TestAttentionAiterFp8StaticQuantPatternModel(
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fp8_linear.kernel.quant_fp8.use_aiter = True
assert self.fp8_linear.input_scale is not None
self.fp8_linear.input_scale.fill_(0.125)
@@ -307,7 +309,7 @@ def test_attention_quant_pattern(
head_size: int,
batch_size: int,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
custom_ops: str,
model_name: str,
model_class: type[AttentionQuantPatternModel],
@@ -24,6 +24,7 @@ from vllm.config import (
PassConfig,
VllmConfig,
)
from vllm.config.cache import CacheDType
from vllm.forward_context import get_forward_context, set_forward_context
from vllm.model_executor.layers.attention import MLAAttention
from vllm.model_executor.layers.linear import ColumnParallelLinear
@@ -254,7 +255,7 @@ def test_mla_rope_kvcache_cat_fusion(
block_size: int,
is_neox: bool,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
monkeypatch: pytest.MonkeyPatch,
):
torch.set_default_device("cuda")
@@ -39,6 +39,7 @@ from vllm.config import (
PassConfig,
VllmConfig,
)
from vllm.config.cache import CacheDType
from vllm.forward_context import get_forward_context, set_forward_context
from vllm.model_executor.layers.attention import Attention
from vllm.model_executor.layers.layernorm import RMSNorm
@@ -342,7 +343,7 @@ def _run_qk_norm_rope_kvcache_fusion_test(
use_shuffle_kv_layout: str,
kv_layout: KVCacheLayout,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
rms_norm_eps: float,
custom_op: str,
monkeypatch: pytest.MonkeyPatch,
@@ -611,7 +612,7 @@ def test_qk_norm_rope_kvcache_fusion(
kv_layout: KVCacheLayout,
block_size: int,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
rms_norm_eps: float,
custom_op: str,
monkeypatch: pytest.MonkeyPatch,
@@ -663,7 +664,7 @@ def test_qk_norm_mrope_kvcache_fusion(
mrope_interleaved: bool,
is_neox: bool,
kv_layout: KVCacheLayout,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
monkeypatch: pytest.MonkeyPatch,
):
_run_qk_norm_rope_kvcache_fusion_test(
@@ -30,6 +30,7 @@ from vllm.config import (
PassConfig,
VllmConfig,
)
from vllm.config.cache import CacheDType
from vllm.config.utils import Range
from vllm.forward_context import get_forward_context, set_forward_context
from vllm.model_executor.layers.attention import Attention
@@ -324,7 +325,7 @@ def test_rope_kvcache_fusion(
block_size: int,
is_neox: bool,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
monkeypatch: pytest.MonkeyPatch,
):
torch.set_default_device("cuda")
@@ -468,7 +469,7 @@ def test_rope_static_qquant_kvcache_fusion(
block_size: int,
is_neox: bool,
dtype: torch.dtype,
kv_cache_dtype: str,
kv_cache_dtype: CacheDType,
monkeypatch: pytest.MonkeyPatch,
):
torch.set_default_device("cuda")
@@ -60,7 +60,7 @@ class TestSiluMulFp8QuantModel(torch.nn.Module):
def __init__(
self,
hidden_size: int,
force_kernel: FP8ScaledMMLinearKernel,
force_kernel: type[FP8ScaledMMLinearKernel],
dtype: torch.dtype,
**kwargs,
):
@@ -282,7 +282,7 @@ def test_fusion_silu_and_mul_quant(
],
enable_silu_mul_custom_op: bool,
enable_quant_fp8_custom_op: bool,
force_kernel: FP8ScaledMMLinearKernel | None,
force_kernel: type[FP8ScaledMMLinearKernel] | None,
monkeypatch: pytest.MonkeyPatch,
):
if model_class is TestSiluMulNvfp4QuantModel and not is_nvfp4_supported():
@@ -330,7 +330,10 @@ def test_fusion_silu_and_mul_quant(
passes = [NoOpEliminationPass(config), *fusion_passes, PostCleanupPass(config)]
backend = TestBackend(*passes)
model = model_class(
hidden_size=hidden_size, force_kernel=force_kernel, x=x, dtype=dtype
hidden_size=hidden_size,
force_kernel=force_kernel, # type: ignore[arg-type]
x=x,
dtype=dtype,
)
# First dimension dynamic
@@ -84,7 +84,7 @@ def test_manual_fusion_fp8_static_with_linear(
num_tokens: int,
hidden_size: int,
dtype: torch.dtype,
force_kernel: FP8ScaledMMLinearKernel,
force_kernel: type[FP8ScaledMMLinearKernel],
):
"""Test manual fusion with real FP8 linear layer (kFp8StaticTensorSym).