Disable mypy `arg-type` and `assignment` checks in tests (#59428)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Harry Mellor committed
Sep 30, 2026 at 16:18 UTC
fc2c801ad93bcd8d7cd863645ee3ac8533cc85be
131 files changed
+402
-409
pyproject.toml
+5
@@ -117,6 +117,11 @@ ignore_missing_imports = true
117
check_untyped_defs = true
118
follow_imports = "silent"
119
120
+[[tool.mypy.overrides]]
121
+module = "tests.*"
122
+disable_error_code = ["arg-type", "assignment"]
123
+enable_error_code = ["method-assign"]
124
+
125
[tool.pytest.ini_options]
126
markers = [
127
"slow_test",
tests/benchmarks/test_bfcl_dataset.py
+2
-2
@@ -271,7 +271,7 @@ def test_bfcl_prompt_len_includes_tools(tmp_path: Path) -> None:
271
args.num_prompts = 1
272
273
with _patch_hf_api(fake_download):
274
- samples = get_samples(args, fake) # type: ignore[arg-type]
274
+ samples = get_samples(args, fake)
275
276
assert len(samples) == 1
277
assert captured["tools"] is not None, (
@@ -311,7 +311,7 @@ def test_bfcl_prompt_len_falls_back_when_tokenizer_rejects_tools(
311
args.num_prompts = 1
312
313
with _patch_hf_api(fake_download):
314
- samples = get_samples(args, _LegacyTokenizer()) # type: ignore[arg-type]
314
+ samples = get_samples(args, _LegacyTokenizer())
315
316
assert len(samples) == 1
317
assert samples[0].prompt_len > 0
tests/benchmarks/test_custom_dataset_chat_template_kwargs.py
+2
-2
@@ -58,7 +58,7 @@ def test_chat_template_kwargs_forwarded(tmp_path: Path) -> None:
58
_write_one(jsonl)
59
60
tok = _RecordingTokenizer()
61
- get_samples(_args(str(jsonl), {"thinking": True}), tok) # type: ignore[arg-type]
61
+ get_samples(_args(str(jsonl), {"thinking": True}), tok)
62
63
assert tok.captured_kwargs == {"thinking": True}
64
@@ -70,6 +70,6 @@ def test_chat_template_kwargs_default_is_noop(tmp_path: Path) -> None:
70
_write_one(jsonl)
71
72
tok = _RecordingTokenizer()
73
- get_samples(_args(str(jsonl), None), tok) # type: ignore[arg-type]
73
+ get_samples(_args(str(jsonl), None), tok)
74
75
assert tok.captured_kwargs == {}
tests/compile/passes/distributed/test_async_tp.py
+1
-1
@@ -285,7 +285,7 @@ def test_async_tp_pass_requires_full_graph_compilation():
285
]
286
287
async_tp_pass = object.__new__(AsyncTPPass)
288
- async_tp_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment]
288
+ async_tp_pass.compilation_config = vllm_config.compilation_config
289
290
with pytest.raises(
291
AssertionError, match="AsyncTPPass requires full-graph compilation"
tests/compile/passes/distributed/test_fusion_all_reduce.py
+2
-2
@@ -111,7 +111,7 @@ def test_fused_ar_workspace_hidden_dim(
111
target_hidden: int, draft_hidden: int | None, expected: int
112
):
113
config = _make_workspace_hidden_config(target_hidden, draft_hidden)
114
- assert _fused_ar_workspace_hidden_dim(config) == expected # type: ignore[arg-type]
114
+ assert _fused_ar_workspace_hidden_dim(config) == expected
115
116
117
def test_fused_ar_workspace_hidden_dim_spec_without_draft():
@@ -120,7 +120,7 @@ def test_fused_ar_workspace_hidden_dim_spec_without_draft():
120
model_config=SimpleNamespace(get_hidden_size=lambda: 2048),
121
speculative_config=SimpleNamespace(draft_model_config=None),
122
)
123
- assert _fused_ar_workspace_hidden_dim(config) == 2048 # type: ignore[arg-type]
123
+ assert _fused_ar_workspace_hidden_dim(config) == 2048
124
125
126
class TestAllReduceRMSNormModel(torch.nn.Module):
tests/compile/passes/distributed/test_sequence_parallelism.py
+1
-1
@@ -222,7 +222,7 @@ def test_sequence_parallelism_pass_requires_full_graph_compilation():
222
]
223
224
sequence_parallelism_pass = object.__new__(SequenceParallelismPass)
225
- sequence_parallelism_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment]
225
+ sequence_parallelism_pass.compilation_config = vllm_config.compilation_config
226
sequence_parallelism_pass.min_token_num = 1
227
228
with pytest.raises(
tests/compile/passes/test_pass_manager.py
+1
-1
@@ -28,7 +28,7 @@ def test_bad_callable():
28
pass_manager.configure(config)
29
30
with pytest.raises(AssertionError):
31
- pass_manager.add(simple_callable) # type: ignore[arg-type]
31
+ pass_manager.add(simple_callable)
32
33
34
# Pass that inherits from InductorPass
tests/compile/passes/test_silu_mul_quant_fusion.py
+1
-1
@@ -331,7 +331,7 @@ def test_fusion_silu_and_mul_quant(
331
backend = TestBackend(*passes)
332
model = model_class(
333
hidden_size=hidden_size,
334
- force_kernel=force_kernel, # type: ignore[arg-type]
334
+ force_kernel=force_kernel,
335
x=x,
336
dtype=dtype,
337
)
tests/config/test_config_generation.py
+2
-2
@@ -133,7 +133,7 @@ def test_get_diff_sampling_param_includes_penalties():
133
},
134
)
135
136
- diff = ModelConfig.get_diff_sampling_param(fake) # type: ignore[arg-type]
136
+ diff = ModelConfig.get_diff_sampling_param(fake)
137
138
assert diff["presence_penalty"] == 1.5
139
assert diff["frequency_penalty"] == 0.5
@@ -161,7 +161,7 @@ def test_generation_config_penalties_survive_diff_sampling_filter():
161
},
162
)
163
164
- diff = ModelConfig.get_diff_sampling_param(fake) # type: ignore[arg-type]
164
+ diff = ModelConfig.get_diff_sampling_param(fake)
165
166
assert diff["presence_penalty"] == 1.1
167
assert diff["frequency_penalty"] == 0.7
tests/config/test_multimodal_config.py
+5
-5
@@ -40,18 +40,18 @@ def test_supports_multimodal_inputs(model_id, limit_mm_per_prompt, expected):
40
41
42
def test_mm_encoder_attn_backend_str_conversion():
43
- config = MultiModalConfig(mm_encoder_attn_backend="FLASH_ATTN") # type: ignore[arg-type]
43
+ config = MultiModalConfig(mm_encoder_attn_backend="FLASH_ATTN")
44
assert config.mm_encoder_attn_backend == AttentionBackendEnum.FLASH_ATTN
45
46
47
def test_mm_encoder_attn_backend_invalid():
48
with pytest.raises(ValueError):
49
- MultiModalConfig(mm_encoder_attn_backend="not_a_backend") # type: ignore[arg-type]
49
+ MultiModalConfig(mm_encoder_attn_backend="not_a_backend")
50
51
52
def test_mm_hasher_algorithm_invalid():
53
with pytest.raises(ValueError, match="mm_hasher_algorithm"):
54
- MultiModalConfig(mm_hasher_algorithm="md5") # type: ignore[arg-type]
54
+ MultiModalConfig(mm_hasher_algorithm="md5")
55
56
57
def test_mm_encoder_attn_backend_hash_updates():
@@ -560,7 +560,7 @@ def _resolve_mm_processor_device(
560
"""Run the `auto` resolution and report where the processor ended up."""
561
mm_config = MultiModalConfig(
562
mm_processor_kwargs={} if device is None else {"device": device},
563
- mm_tensor_ipc=mm_tensor_ipc, # type: ignore[arg-type]
563
+ mm_tensor_ipc=mm_tensor_ipc,
564
)
565
model_config = MagicMock(spec=ModelConfig)
566
model_config.multimodal_config = mm_config
@@ -662,7 +662,7 @@ def _resolve_mm_video_decode_device(
662
the resulting video media IO kwargs."""
663
mm_config = MultiModalConfig(
664
mm_processor_kwargs={} if device is None else {"device": device},
665
- mm_tensor_ipc=mm_tensor_ipc, # type: ignore[arg-type]
665
+ mm_tensor_ipc=mm_tensor_ipc,
666
media_io_kwargs={} if video_kwargs is None else {"video": dict(video_kwargs)},
667
)
668
model_config = MagicMock(spec=ModelConfig)
tests/conftest.py
+1
-1
@@ -1163,7 +1163,7 @@ class VllmRunner:
1163
output_logprobs = sample.logprobs
1164
if include_prompt_token_ids:
1165
outputs.append(
1166
- ( # type: ignore[arg-type]
1166
+ (
1167
output_ids,
1168
output_str,
1169
output_logprobs,
tests/entrypoints/anthropic/test_anthropic_messages_conversion.py
+1
-1
@@ -1447,7 +1447,7 @@ class TestDetectMergeInlineSystem:
1447
model_config=None,
1448
)
1449
assert (
1450
- AnthropicServingMessages._should_merge_inline_system(online_renderer) # type: ignore[arg-type]
1450
+ AnthropicServingMessages._should_merge_inline_system(online_renderer)
1451
is expected
1452
)
1453
assert mock_logger.warning_once.called is expected
tests/entrypoints/cohere/test_cohere_chat_message.py
+2
-2
@@ -29,7 +29,7 @@ from vllm.entrypoints.cohere.cohere_chat_message import (
29
class TestCitationSource:
30
def test_invalid_type_rejected(self):
31
with pytest.raises(ValidationError):
32
- CitationSource(type="other") # type: ignore[arg-type]
32
+ CitationSource(type="other")
33
34
def test_none_fields_excluded_from_dump(self):
35
s = CitationSource(type="document", id="d1")
@@ -65,7 +65,7 @@ class TestCitationSource:
65
class TestCitation:
66
def test_invalid_type_rejected(self):
67
with pytest.raises(ValidationError):
68
- Citation(type="OTHER") # type: ignore[arg-type]
68
+ Citation(type="OTHER")
69
70
def test_dump_excludes_none_fields(self):
71
c = Citation(start=0, end=5, text="hello")
tests/entrypoints/cohere/test_protocol.py
+2
-2
@@ -136,7 +136,7 @@ class TestCohereChatV2Response:
136
with pytest.raises(ValidationError):
137
CohereChatV2Response(
138
id="r1",
139
- finish_reason="NOT_A_REASON", # type: ignore[arg-type]
139
+ finish_reason="NOT_A_REASON",
140
message=msg,
141
)
142
@@ -246,5 +246,5 @@ class TestStreamingEventTypeField:
246
MessageStartEvent(
247
id="a",
248
delta={"message": {"role": "assistant"}},
249
- type="other", # type: ignore[arg-type]
249
+ type="other",
250
)
tests/entrypoints/launchers/api_server/test_api_server_process_manager.py
+3
-3
@@ -308,7 +308,7 @@ def test_external_process_monitoring(api_server_args):
308
try:
309
wait_for_completion_or_failure(
310
api_server_manager=manager,
311
- coordinator=mock_coordinator, # type: ignore[arg-type]
311
+ coordinator=mock_coordinator,
312
)
313
except Exception as e:
314
result["exception"] = e
@@ -377,7 +377,7 @@ def test_gather_actual_addresses_end_to_end():
377
manager = APIServerProcessManager(
378
listen_address=f"tcp://{host}:0",
379
sock=sock,
380
- args="test_args", # type: ignore[arg-type]
380
+ args="test_args",
381
num_servers=num_servers,
382
input_addresses=placeholder_inputs,
383
output_addresses=placeholder_outputs,
@@ -424,7 +424,7 @@ def test_gather_actual_addresses_child_crash_before_report():
424
manager = APIServerProcessManager(
425
listen_address=f"tcp://{host}:0",
426
sock=sock,
427
- args="test_args", # type: ignore[arg-type]
427
+ args="test_args",
428
num_servers=num_servers,
429
input_addresses=placeholder_inputs,
430
output_addresses=placeholder_outputs,
tests/entrypoints/multimodal/llm/test_mm_processor_kwargs.py
+1
-1
@@ -14,7 +14,7 @@ from vllm.outputs import RequestOutput
14
15
def _make_mock_llm() -> LLM:
16
llm = object.__new__(LLM)
17
- llm.model_config = SimpleNamespace( # type: ignore[assignment]
17
+ llm.model_config = SimpleNamespace(
18
runner_type="generate", enable_prompt_embeds=False
19
)
20
return llm
tests/entrypoints/openai/test_render_parity.py
+1
-1
@@ -225,7 +225,7 @@ def online_renderer(model_config: MockModelConfig, request) -> OnlineRenderer:
225
renderer.tokenizer = MagicMock()
226
227
return OnlineRenderer(
228
- model_config=model_config, # type: ignore[arg-type]
228
+ model_config=model_config,
229
renderer=renderer,
230
request_logger=None,
231
chat_template=None,
tests/entrypoints/pooling/embed/test_io_processor.py
+1
-1
@@ -411,7 +411,7 @@ class TestChunkedEmbeddingProcessing:
411
@classmethod
412
def _make_handler(cls):
413
handler = object.__new__(EmbedIOProcessor)
414
- handler.model_config = cls._FakeModelConfig() # type: ignore[assignment]
414
+ handler.model_config = cls._FakeModelConfig()
415
handler.enable_chunked_processing = True
416
return handler
417
tests/entrypoints/pooling/scoring/test_io_processor_unit.py
+2
-2
@@ -47,7 +47,7 @@ def llm_reranker_processor() -> CrossEncoderIOProcessor:
47
)
48
49
processor = CrossEncoderIOProcessor.__new__(CrossEncoderIOProcessor)
50
- processor.model_config = SimpleNamespace(enable_prompt_embeds=False) # type: ignore[assignment]
50
+ processor.model_config = SimpleNamespace(enable_prompt_embeds=False)
51
processor.tokenizer = TokenizersBackend(
52
tokenizer_object=backend,
53
unk_token="[UNK]",
@@ -96,7 +96,7 @@ def test_token_type_ids_stay_aligned_with_a_truncated_padded_prompt():
96
)
97
98
processed_prompt = tok_params.apply_post_tokenization(
99
- tokenizer, # type: ignore[arg-type]
99
+ tokenizer,
100
prompt,
101
)
102
assert "prompt_token_ids" in processed_prompt
tests/entrypoints/pooling/scoring/test_jina_ranking_io_processor_unit.py
+2
-4
@@ -77,10 +77,8 @@ def offline_processor_and_context():
77
backend.pre_tokenizer = pre_tokenizers.WhitespaceSplit()
78
proc = JinaRankingIOProcessor.__new__(JinaRankingIOProcessor)
79
proc.tokenizer = TokenizersBackend(tokenizer_object=backend)
80
- proc.model_config = SimpleNamespace( # type: ignore[assignment]
81
- max_model_len=1024, is_encoder_decoder=False
82
- )
83
- proc.renderer = SimpleNamespace( # type: ignore[assignment]
80
+ proc.model_config = SimpleNamespace(max_model_len=1024, is_encoder_decoder=False)
81
+ proc.renderer = SimpleNamespace(
82
default_cmpl_tok_params=TokenizeParams(max_total_tokens=1024)
83
)
84
ctx = OfflineScoringInputsContext(
tests/entrypoints/pooling/test_io_processor.py
+2
-2
@@ -53,8 +53,8 @@ def test_rejects_mismatched_lora_requests(processor: PoolingIOProcessor):
53
54
55
def test_rejects_conflicting_pooling_task(processor: PoolingIOProcessor):
56
- processor.model_config = SimpleNamespace(is_encoder_decoder=False) # type: ignore[assignment]
57
- processor.renderer = SimpleNamespace( # type: ignore[assignment] # Tokenization defaults only.
56
+ processor.model_config = SimpleNamespace(is_encoder_decoder=False)
57
+ processor.renderer = SimpleNamespace(
58
default_cmpl_tok_params=TokenizeParams(max_total_tokens=None)
59
)
60
ctx = OfflineEncodeInputsContext(
tests/entrypoints/serve/middleware/test_authentication_middleware.py
+1
-1
@@ -87,7 +87,7 @@ def task_routes(request, monkeypatch) -> tuple[str, list[tuple[str, list[str]]]]
87
args,
88
app,
89
supported_tasks=(task,),
90
- model_config=MockModelConfig(), # type: ignore[arg-type]
90
+ model_config=MockModelConfig(),
91
)
92
93
routes = get_all_http_routes(app)
tests/entrypoints/serve/tokenize/test_tokenization.py
+2
-2
@@ -107,7 +107,7 @@ async def test_tokenize_chat(
107
conversation=conversation,
108
tokenize=False,
109
)
110
- tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type]
110
+ tokens = tokenizer.encode(prompt, add_special_tokens=add_special)
111
112
response = requests.post(
113
server.url_for("tokenize"),
@@ -176,7 +176,7 @@ async def test_tokenize_chat_with_tools(
176
tools=tools,
177
tokenize=False,
178
)
179
- tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type]
179
+ tokens = tokenizer.encode(prompt, add_special_tokens=add_special)
180
181
response = requests.post(
182
server.url_for("tokenize"),
tests/entrypoints/speech_to_text/transcription/test_qwen3_asr_sanitize_prompt.py
+1
-1
@@ -47,7 +47,7 @@ def test_sanitize_handles_falsy_inputs() -> None:
47
assert _sanitize_transcription_user_text("") == ""
48
# The dataclass default for ``response_prefix`` is the empty string;
49
# the sanitizer must accept that without exception or extra work.
50
- assert _sanitize_transcription_user_text(None) == "" # type: ignore[arg-type]
50
+ assert _sanitize_transcription_user_text(None) == ""
51
52
53
def test_sanitize_is_idempotent() -> None:
tests/entrypoints/unit_tests/test_chat_utils.py
+2
-2
@@ -216,7 +216,7 @@ def video_url():
216
@pytest.fixture(scope="module")
217
def audio_url():
218
audio = AudioAsset("mary_had_lamb")
219
- return encode_audio_url(*audio.audio_and_sample_rate) # type: ignore[arg-type]
219
+ return encode_audio_url(*audio.audio_and_sample_rate)
220
221
222
def _assert_mm_data_is_image_input(
@@ -3194,5 +3194,5 @@ def test_validate_chat_template_rejects_invalid_type():
3194
with pytest.raises(
3195
VLLMValidationError, match="not a valid chat template type"
3196
) as exc_info:
3197
- validate_chat_template(123) # type: ignore[arg-type]
3197
+ validate_chat_template(123)
3198
assert exc_info.value.parameter == "chat_template"
tests/jit_monitor/test_hooks.py
+1
-1
@@ -149,7 +149,7 @@ def test_activate_logs_info():
149
150
def test_activate_rejects_unknown_mode():
151
with pytest.raises(ValueError, match="Unsupported JIT monitor mode"):
152
- jit_monitor.activate(mode="panic") # type: ignore[arg-type]
152
+ jit_monitor.activate(mode="panic")
153
154
155
def test_activate_without_triton():
tests/kernels/attention/test_attention_selector.py
+4
-4
@@ -23,12 +23,12 @@ from vllm.platforms.interface import DeviceCapability
23
if current_platform.is_cuda():
24
from vllm.platforms.cuda import CudaPlatform
25
else:
26
- CudaPlatform = None # type: ignore[assignment] # Unavailable platform import.
26
+ CudaPlatform = None
27
28
if current_platform.is_rocm():
29
from vllm.platforms.rocm import RocmPlatform
30
else:
31
- RocmPlatform = None # type: ignore[misc, assignment] # Unavailable platform import.
31
+ RocmPlatform = None # type: ignore[misc] # Unavailable platform import.
32
33
from vllm.v1.attention.backend import AttentionType
34
from vllm.v1.attention.backends.registry import AttentionBackendEnum
@@ -356,14 +356,14 @@ def test_invalid_backend():
356
def test_auto_backend_string(auto_value: str):
357
"""Test that 'auto' string value triggers automatic backend selection."""
358
# Using "auto" should result in backend=None (automatic selection)
359
- attention_config = AttentionConfig(backend=auto_value) # type: ignore[arg-type]
359
+ attention_config = AttentionConfig(backend=auto_value)
360
assert attention_config.backend is None
361
362
363
def test_auto_backend_selection_behavior():
364
"""Test that 'auto' backend behaves same as None (automatic selection)."""
365
# Create config with explicit "auto"
366
- auto_config = AttentionConfig(backend="auto") # type: ignore[arg-type]
366
+ auto_config = AttentionConfig(backend="auto")
367
368
# Create config with None (default)
369
none_config = AttentionConfig(backend=None)
tests/kernels/attention/test_cpu_attn.py
+1
-1
@@ -836,7 +836,7 @@ def varlen_encoder_zentorch_sdpa(
836
key,
837
value,
838
output,
839
- SimpleNamespace(query_start_loc=query_start_loc, causal=False), # type: ignore[arg-type]
839
+ SimpleNamespace(query_start_loc=query_start_loc, causal=False),
840
scale,
841
sliding_window if sliding_window is not None else -1,
842
alibi_slopes,
tests/kernels/attention/test_minimax_m3.py
+1
-1
@@ -1782,7 +1782,7 @@ def test_aiter_indexer_requires_the_aiter_attend(monkeypatch):
1782
num_index_heads=1,
1783
index_head_dim=HEAD_DIM,
1784
# The implementation also accepts this legacy fp8 alias.
1785
- indexer_kv_dtype="fp8_e4m3", # type: ignore[arg-type]
1785
+ indexer_kv_dtype="fp8_e4m3",
1786
max_model_len=8192,
1787
)
1788
tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py
+5
-5
@@ -235,14 +235,14 @@ def test_msa_metadata_builder_prepares_cutlass_for_regular_decode(
235
builder.num_q_heads = 64
236
builder.num_kv_heads = 4
237
builder.topk_blocks = TOPK
238
- builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4) # type: ignore[assignment]
238
+ builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4)
239
builder.kv_cache_dtype = "fp8_e4m3"
240
builder.decode_backend = "cutlass"
241
- builder.msa_cutlass_plan_cache = object() # type: ignore[assignment] # Mocked plan-cache sentinel.
241
+ builder.msa_cutlass_plan_cache = object()
242
243
metadata = builder.build(
244
0,
245
- SimpleNamespace( # type: ignore[arg-type]
245
+ SimpleNamespace(
246
seq_lens_cpu_upper_bound=torch.full((batch,), 257, dtype=torch.int32)
247
),
248
)
@@ -377,7 +377,7 @@ def test_query_fp8_stays_valid_when_cutlass_plan_appears_on_replay(
377
with torch.cuda.stream(stream), override_forward_context(forward_context):
378
capture = BreakableCUDAGraphCapture()
379
with capture:
380
- query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv) # type: ignore[arg-type]
380
+ query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv)
381
if query_fp8 is not None:
382
query_fp8.zero_()
383
run_attention(query_fp8)
@@ -387,7 +387,7 @@ def test_query_fp8_stays_valid_when_cutlass_plan_appears_on_replay(
387
assert capture.num_eager_breaks == 1
388
assert observed_ptrs == []
389
390
- decode.msa_cutlass = object() # type: ignore[assignment]
390
+ decode.msa_cutlass = object()
391
for _ in range(3):
392
capture.replay()
393
stream.synchronize()
tests/kernels/attention/test_rocm_aiter_mla_causal_verify_mask.py
+1
-1
@@ -204,7 +204,7 @@ def _run_verify_block():
204
),
205
):
206
assert isinstance(impl, AiterMLAImpl)
207
- impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None) # type: ignore[arg-type] # Spy decode path does not read layer.
207
+ impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None)
208
209
return metadata, captured
210
tests/kernels/attention/test_rocm_aiter_mla_fp8_prefill.py
+2
-2
@@ -121,7 +121,7 @@ def _build_prefill_metadata(
121
122
builder = object.__new__(AiterMLAMetadataBuilder)
123
builder.num_heads = num_heads
124
- builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM) # type: ignore[assignment]
124
+ builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM)
125
builder._init_fp8_prefill_ps_buffers(
126
max_num_reqs=len(seq_lens),
127
max_prefill_qlen=max_q,
@@ -136,7 +136,7 @@ def _build_prefill_metadata(
136
prefill = SimpleNamespace(query_start_loc=qo_indptr, max_query_len=max_q)
137
metadata = SimpleNamespace(prefill=prefill, num_decodes=0)
138
common = SimpleNamespace(query_start_loc_cpu=qo_indptr_cpu)
139
- builder._build_fp8_prefill_ps_metadata(metadata, common) # type: ignore[arg-type]
139
+ builder._build_fp8_prefill_ps_metadata(metadata, common)
140
return metadata, total_q, builder
141
142
tests/kernels/attention/test_rocm_aiter_mla_sink.py
+6
-6
@@ -170,7 +170,7 @@ def test_sparse_mla_sink_matches_ragged_reference(
170
SimpleNamespace(_q_scale=q_scale, _k_scale=kv_scale),
171
q,
172
kv,
173
- metadata, # type: ignore[arg-type]
173
+ metadata,
174
)
175
kv_flat = kv_ref[:, 0]
176
references = []
@@ -244,7 +244,7 @@ def test_sparse_mla_sink_rejects_unsupported_aiter_dtypes(
244
SimpleNamespace(_q_scale=None, _k_scale=None),
245
torch.empty(1, 16, Q_HEAD_DIM, dtype=q_dtype),
246
torch.empty(1, 1, Q_HEAD_DIM, dtype=kv_dtype),
247
- metadata, # type: ignore[arg-type]
247
+ metadata,
248
)
249
250
@@ -384,7 +384,7 @@ def test_sparse_mla_sink_matches_dense_attention_with_empty_rows_and_paged_cache
384
paged_kv_indices=torch.tensor(indices, dtype=torch.int32, device="cuda"),
385
paged_kv_indptr=lengths.cumsum(0).to(device="cuda", dtype=torch.int32),
386
)
387
- impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl) # type: ignore[arg-type]
387
+ impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl)
388
impl.num_heads = num_heads
389
impl.head_size = head_dim
390
impl.kv_lora_rank = value_dim
@@ -441,9 +441,9 @@ def test_sparse_mla_backend_resolves_only_contiguous_layer_layouts(monkeypatch,
441
]
442
if layout == "BLNHC":
443
with pytest.raises(ValueError, match="does not satisfy"):
444
- resolve_kv_cache_layout(config, supported) # type: ignore[arg-type]
444
+ resolve_kv_cache_layout(config, supported)
445
else:
446
- assert resolve_kv_cache_layout(config, supported).name == layout # type: ignore[arg-type]
446
+ assert resolve_kv_cache_layout(config, supported).name == layout
447
448
449
@pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float16])
@@ -494,7 +494,7 @@ def test_sparse_mla_sink_forward_mqa_preserves_split_query(dtype):
494
actual, _ = impl.forward_mqa(
495
(q[..., :V_HEAD_DIM], q[..., V_HEAD_DIM:]),
496
kv,
497
- metadata, # type: ignore[arg-type]
497
+ metadata,
498
SimpleNamespace(_q_scale=None, _k_scale=None),
499
)
500
references = [
tests/kernels/attention/test_rocm_aiter_mla_sparse_metadata_sync.py
+2
-2
@@ -39,10 +39,10 @@ def _make_builder():
39
topk_tokens = 4
40
41
builder.device = torch.device("cpu")
42
- builder.kv_cache_spec = SimpleNamespace(block_size=1) # type: ignore[assignment]
42
+ builder.kv_cache_spec = SimpleNamespace(block_size=1)
43
builder.model_dtype = torch.bfloat16
44
builder.kv_cache_dtype = "fp8"
45
- builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64) # type: ignore[assignment]
45
+ builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64)
46
builder.topk_tokens = topk_tokens
47
builder.req_id_per_token_buffer = torch.zeros(
48
max_num_batched_tokens, dtype=torch.int32, device="cpu"
tests/kernels/attention/test_rocm_paged_mxfp4_indexer.py
+2
-4
@@ -227,9 +227,7 @@ def _decode_metadata(case, rows, ratio, query_lens):
227
num_decode_tokens=len(rows),
228
num_prefills=0,
229
num_prefill_tokens=0,
230
- decode=types.SimpleNamespace( # type: ignore[arg-type]
231
- block_table=block_table, seq_lens=lens[:, None]
232
- ),
230
+ decode=types.SimpleNamespace(block_table=block_table, seq_lens=lens[:, None]),
231
decode_row_lens=lens,
232
decode_block_ends=(lens + CAND_BLOCK - 1) // CAND_BLOCK,
233
decode_native=native,
@@ -280,7 +278,7 @@ def _prefill_metadata(
278
num_decode_tokens=0,
279
num_prefills=len(case.seq_lens),
280
num_prefill_tokens=len(rows),
283
- prefill=types.SimpleNamespace(chunks=chunks), # type: ignore[arg-type]
281
+ prefill=types.SimpleNamespace(chunks=chunks),
282
prefill_plans=plans,
283
gather_launches=plan_gather_launches(chunks, plans, gather_rows),
284
)
tests/kernels/attention/test_rocm_triton_attn_dsv4.py
+2
-2
@@ -955,7 +955,7 @@ def test_rocm_capture_metadata_sets_adaptive_marker(monkeypatch) -> None:
955
)
956
builder = object.__new__(rocm_mod.DeepseekV4ROCMAiterMLASparseMetadataBuilder)
957
958
- actual = builder.build_for_cudagraph_capture(SimpleNamespace()) # type: ignore[arg-type] # Patched base method ignores metadata.
958
+ actual = builder.build_for_cudagraph_capture(SimpleNamespace())
959
960
assert actual is metadata
961
assert actual.for_cudagraph_capture is _on_gfx950()
@@ -1563,7 +1563,7 @@ def test_dsv4_adaptive_mla_swa_metadata_graph_replay(monkeypatch) -> None:
1563
"sliding_window": window_size,
1564
},
1565
)
1566
- vllm_config.speculative_config = SimpleNamespace( # type: ignore[assignment]
1566
+ vllm_config.speculative_config = SimpleNamespace(
1567
num_speculative_tokens=upper_query_len - 1,
1568
parallel_drafting=False,
1569
enable_adaptive_verification=True,
tests/kernels/mamba/test_gdn_forward_core_split.py
+1
-1
@@ -176,7 +176,7 @@ def test_forward_core_split_matches_unified(
176
builder = GDNAttentionMetadataBuilder(
177
# GDNAttentionMetadataBuilder declares kv_cache_spec as AttentionSpec but
178
# asserts isinstance(kv_cache_spec, MambaSpec). MambaSpec is correct here.
179
- kv_cache_spec=MambaSpec( # type: ignore[arg-type]
179
+ kv_cache_spec=MambaSpec(
180
block_size=BLOCK_SIZE, shapes=((16, 64),), dtypes=(torch.float16,)
181
),
182
layer_names=[PREFIX],
tests/kernels/moe/test_cutlass_moe.py
+1
-1
@@ -538,7 +538,7 @@ def run_8_bit(
538
assert num_local_experts is not None
539
return run_with_expert_maps(
540
num_experts,
541
- num_local_experts, # type: ignore[arg-type]
541
+ num_local_experts,
542
quant_config,
543
**kwargs,
544
)
tests/kernels/moe/test_ocp_mx_moe.py
+1
-1
@@ -1724,7 +1724,7 @@ def test_rocm_mxfp4_moe_oracle(
1724
w13_conv, w2_conv, w13_scale_conv, w2_scale_conv, w13_bias_conv, w2_bias_conv = (
1725
convert_gpt_oss_weight_to_mxfp4_moe_kernel_format(
1726
mxfp4_backend=backend,
1727
- layer=layer, # type: ignore[arg-type]
1727
+ layer=layer,
1728
w13_weight=w13_quant,
1729
w2_weight=w2_quant,
1730
w13_weight_scale=w13_scale,
tests/kernels/quantization/test_block_fp8.py
+1
-1
@@ -259,7 +259,7 @@ def test_w8a8_block_fp8_torch_scaled_mm_matmul():
259
stub = BlockWiseTorchFP8ScaledMMLinearKernel.__new__(
260
BlockWiseTorchFP8ScaledMMLinearKernel
261
)
262
- stub.config = types.SimpleNamespace(out_dtype=out_dtype) # type: ignore[assignment]
262
+ stub.config = types.SimpleNamespace(out_dtype=out_dtype)
263
out = stub.apply_block_scaled_mm(
264
A_fp8_cuda.cuda(), B_fp8.cuda(), As_cuda.cuda(), Bs.cuda()
265
)
tests/kernels/quantization/test_cutlass_w4a8.py
+1
-1
@@ -208,7 +208,7 @@ def mm_test_helper(
208
a=tensors.a,
209
b_q=tensors.w_q,
210
b_group_scales=tensors.w_g_s,
211
- b_group_size=group_size, # type: ignore[arg-type]
211
+ b_group_size=group_size,
212
b_channel_scales=tensors.w_ch_s,
213
a_token_scales=tensors.w_tok_s,
214
)
tests/kernels/quantization/test_marlin_tile_padding.py
+2
-4
@@ -525,15 +525,13 @@ def test_check_marlin_supports_layer_allow_tile_padding():
525
)
526
527
# Tile-misaligned but group-aligned: rejected strictly, allowed w/ padding
528
- layer: LinearBase = _FakeLinear( # type: ignore[assignment]
529
- 4640, 512, input_size=2048
530
- )
528
+ layer: LinearBase = _FakeLinear(4640, 512, input_size=2048)
529
assert not check_marlin_supports_layer(layer, 128)
530
assert check_marlin_supports_layer(layer, 128, allow_tile_padding=True)
531
assert check_marlin_supports_layer(layer, -1, allow_tile_padding=True)
532
533
# A group straddling the TP shard cannot be fixed by padding
536
- layer = _FakeLinear(4608, 4672, input_size=18688) # type: ignore[assignment]
534
+ layer = _FakeLinear(4608, 4672, input_size=18688)
535
assert not check_marlin_supports_layer(layer, 128, allow_tile_padding=True)
536
537
tests/kernels/quantization/test_nvfp4_emulation.py
+1
-1
@@ -206,7 +206,7 @@ def test_nvfp4_emulation_support_check_rejects_bias_and_lora(
206
in_dtype=torch.bfloat16,
207
device="cuda",
208
routing_method=RoutingMethodType.TopK,
209
- **config_kwargs, # type: ignore[arg-type]
209
+ **config_kwargs,
210
)
211
212
supported, reason = Nvfp4QuantizationEmulationTritonExperts.is_supported_config(
tests/model_executor/layers/test_fused_shared_expert.py
+3
-3
@@ -413,7 +413,7 @@ def test_deepseek_v4_shared_expert_fse_uses_mtp_quantization_config_prefix(
413
)
414
415
compatible, reason = is_shared_expert_quant_fse_compatible(
416
- DeepseekV4Config(), # type: ignore[arg-type]
416
+ DeepseekV4Config(),
417
"model.layers.2.ffn.experts",
418
"model.layers.2.ffn.shared_experts",
419
)
@@ -824,7 +824,7 @@ def test_models_fse_init(
824
model_type, quantization_config
825
)
826
vllm_config = VllmConfig()
827
- vllm_config.model_config = SimpleNamespace( # type: ignore[assignment]
827
+ vllm_config.model_config = SimpleNamespace(
828
hf_config=config,
829
hf_text_config=config,
830
dtype=torch.bfloat16,
@@ -893,7 +893,7 @@ def test_models_fse_init(
893
DeepSeekV4MTP,
894
)
895
896
- vllm_config.speculative_config = SimpleNamespace( # type: ignore[assignment]
896
+ vllm_config.speculative_config = SimpleNamespace(
897
draft_model_config=SimpleNamespace(hf_config=config),
898
method="mtp",
899
parallel_drafting=False,
tests/model_executor/layers/test_mla_short_prefill_indexer.py
+4
-4
@@ -46,7 +46,7 @@ def test_sparse_attention_refreshes_batch_state_inside_eager_segment(
46
47
with pytest.raises(BatchStateRefreshed):
48
DeepseekV32Attention._sparse_indexer_and_attn(
49
- layer, # type: ignore[arg-type]
49
+ layer,
50
torch.empty(1, dtype=torch.long),
51
torch.empty(1, 1),
52
torch.empty(1, 1, 1),
@@ -80,7 +80,7 @@ def make_indexer_metadata(
80
num_decode_tokens=num_decode_tokens,
81
num_prefills=num_prefills,
82
num_prefill_tokens=num_prefill_tokens,
83
- prefill=SimpleNamespace(chunks=[]) if num_prefills else None, # type: ignore[arg-type]
83
+ prefill=SimpleNamespace(chunks=[]) if num_prefills else None,
84
)
85
86
@@ -129,7 +129,7 @@ def test_short_prefill_updates_k_cache_before_scoring_decision(
129
slot_mapping=slot_mapping,
130
)
131
if indexer_metadata.num_decodes:
132
- indexer_metadata.decode = object() # type: ignore[assignment]
132
+ indexer_metadata.decode = object()
133
mla_metadata = make_mla_metadata(
134
use_dense_mha=batch_kind != "force_mqa",
135
num_decode_tokens=mla_num_decode_tokens,
@@ -307,7 +307,7 @@ def test_deepseek_v32_dispatches_selected_mha(
307
output = torch.empty(2, 2)
308
309
DeepseekV32Attention._sparse_indexer_and_attn(
310
- layer, # type: ignore[arg-type]
310
+ layer,
311
torch.arange(2),
312
torch.empty(2, 2),
313
q_nope,
tests/model_executor/layers/test_pooler_activations.py
+2
-2
@@ -224,11 +224,11 @@ class TestResolveClassifierActFn:
224
model_config = SimpleNamespace(
225
hf_config=SimpleNamespace(num_labels=3, problem_type="")
226
)
227
- result = resolve_classifier_act_fn(model_config, act_fn=None) # type: ignore[arg-type]
227
+ result = resolve_classifier_act_fn(model_config, act_fn=None)
228
assert isinstance(result, PoolerClassify)
229
assert result.num_labels == 3
230
231
def test_passes_through_provided_act_fn(self):
232
custom = PoolerIdentity()
233
- result = resolve_classifier_act_fn(None, act_fn=custom) # type: ignore[arg-type]
233
+ result = resolve_classifier_act_fn(None, act_fn=custom)
234
assert result is custom
tests/model_executor/layers/test_pooler_methods.py
+1
-1
@@ -320,7 +320,7 @@ def test_dispatch_seq_cls_honors_token_pooling_type(tok_pooling_type):
320
),
321
)
322
classifier = torch.nn.Linear(4, 3)
323
- with set_current_vllm_config(config): # type: ignore[arg-type]
323
+ with set_current_vllm_config(config):
324
pooler = DispatchPooler.for_seq_cls(pooler_config, classifier=classifier)
325
326
token_ids = [[2, 99, 3, 99], [4, 99], [5, 6]]
tests/model_executor/model_loader/tensorizer_loader/test_tensorizer.py
+1
-1
@@ -36,7 +36,7 @@ try:
36
import tensorizer
37
from tensorizer import EncryptionParams
38
except ImportError:
39
- tensorizer = PlaceholderModule("tensorizer") # type: ignore[assignment]
39
+ tensorizer = PlaceholderModule("tensorizer")
40
EncryptionParams = tensorizer.placeholder_attr("EncryptionParams")
41
42
tests/model_executor/model_loader/test_weight_cache.py
+1
-1
@@ -368,4 +368,4 @@ def test_ipc_loader_copy_mode_reports_no_external_weight_memory():
368
load_format="ipc_cache", model_loader_extra_config={"mode": "copy"}
369
)
370
loader = IpcModelLoader(copy_mode)
371
- assert loader.get_external_weight_memory(None) == 0 # type: ignore[arg-type]
371
+ assert loader.get_external_weight_memory(None) == 0
tests/models/language/generation/test_mistral.py
+3
-3
@@ -259,7 +259,7 @@ def test_mistral_function_calling(vllm_runner, model: str, dtype: str) -> None:
259
260
model_output = outputs[0].outputs[0].text.strip()
261
assert model_output.startswith(tool_parser.bot_token), model_output
262
- parsed_message = tool_parser.extract_tool_calls(model_output, None) # type: ignore[arg-type]
262
+ parsed_message = tool_parser.extract_tool_calls(model_output, None)
263
264
assert parsed_message.tools_called
265
@@ -302,7 +302,7 @@ def test_mistral_function_call_nested_json():
302
303
model_output = f"{parser.bot_token}get_current_weather{json.dumps(args_dict)}"
304
305
- parsed = parser.extract_tool_calls(model_output, None) # type: ignore[arg-type]
305
+ parsed = parser.extract_tool_calls(model_output, None)
306
307
# Assertions: the tool call is detected and the full nested JSON is parsed
308
# without truncation.
@@ -335,7 +335,7 @@ def test_mistral_function_call_nested_json():
335
]
336
)
337
338
- parsed = parser.extract_tool_calls(model_output, None) # type: ignore[arg-type]
338
+ parsed = parser.extract_tool_calls(model_output, None)
339
340
# Assertions: the tool call is detected and the full nested JSON is parsed
341
# without truncation.
tests/models/multimodal/generation/vlm_utils/model_utils.py
+1
-1
@@ -1193,7 +1193,7 @@ def voxtral_patch_hf_runner(hf_model: "HfRunner") -> "HfRunner":
1193
output.sequences = output.sequences[:, prompt_len:]
1194
return output
1195
1196
- hf_model.get_inputs = patched_get_inputs # type: ignore[method-assign, assignment]
1196
+ hf_model.get_inputs = patched_get_inputs # type: ignore[method-assign]
1197
hf_model.model.generate = patched_generate # type: ignore[method-assign]
1198
return hf_model
1199
tests/models/multimodal/pooling/test_clip.py
+1
-1
@@ -132,7 +132,7 @@ def test_models(
132
_run_test(
133
hf_runner,
134
vllm_runner,
135
- input_cases, # type: ignore[arg-type]
135
+ input_cases,
136
model,
137
dtype=dtype,
138
)
tests/models/multimodal/pooling/test_llama_nemotron_vl.py
+1
-1
@@ -190,7 +190,7 @@ def test_models(
190
_run_test(
191
hf_runner,
192
vllm_runner,
193
- input_cases, # type: ignore[arg-type]
193
+ input_cases,
194
model,
195
dtype=dtype,
196
)
tests/models/multimodal/pooling/test_siglip.py
+1
-1
@@ -149,7 +149,7 @@ def test_models(
149
_run_test(
150
hf_runner,
151
vllm_runner,
152
- input_cases, # type: ignore[arg-type]
152
+ input_cases,
153
model,
154
dtype=dtype,
155
)
tests/models/multimodal/processing/test_qwen2_vl.py
+2
-2
@@ -106,7 +106,7 @@ def test_merge_and_resolve_mm_processor_kwargs_preserves_request_alias_precedenc
106
mm_device_do_normalize=False,
107
)
108
model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config)
109
- ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type]
109
+ ctx = InputProcessingContext(model_config, tokenizer=None)
110
info = Qwen2VLProcessingInfo(ctx)
111
monkeypatch.setattr(
112
info,
@@ -236,7 +236,7 @@ def test_get_vision_info_reads_merged_modality_scope(
236
do_resize=False,
237
image_processor=image_processor,
238
mm_kwargs={},
239
- modality=modality, # type: ignore[arg-type]
239
+ modality=modality,
240
)
241
242
assert seen == [merged[scope]]
tests/models/transformers/test_backend.py
+2
-2
@@ -260,7 +260,7 @@ def test_quantization(
260
model,
261
model_impl="auto",
262
enforce_eager=True,
263
- **quantization_kwargs, # type: ignore[arg-type]
263
+ **quantization_kwargs,
264
) as vllm_model:
265
vllm_outputs = vllm_model.generate_greedy_logprobs(
266
example_prompts, max_tokens=max_tokens, num_logprobs=num_logprobs
@@ -270,7 +270,7 @@ def test_quantization(
270
model,
271
model_impl="transformers",
272
enforce_eager=True,
273
- **quantization_kwargs, # type: ignore[arg-type]
273
+ **quantization_kwargs,
274
) as vllm_model:
275
model_config = vllm_model.llm.llm_engine.model_config
276
assert model_config.using_transformers_backend()
tests/multimodal/media/test_video.py
+1
-1
@@ -385,7 +385,7 @@ def test_pynvvideocodec_unrelated_error_propagates(
385
PyNvVideoCodecVideoBackendMixin.decode_frames_pynvvideocodec(
386
None,
387
b"video",
388
- None, # type: ignore[arg-type] # Fails before target metadata is used.
388
+ None,
389
)
390
391
assert exc_info.value is original_error
tests/multimodal/test_audio.py
+1
-1
@@ -179,7 +179,7 @@ def test_audio_resampler_invalid_method(dummy_audio):
179
# Validated eagerly so a bad method fails at construction, not on the
180
# first audio request.
181
with pytest.raises(ValueError, match="Invalid resampling method"):
182
- AudioResampler(target_sr=22050, method="invalid") # type: ignore[arg-type]
182
+ AudioResampler(target_sr=22050, method="invalid")
183
184
185
def test_audio_resampler_no_target_sr(dummy_audio):
tests/multimodal/test_cache.py
+12
-12
@@ -276,14 +276,14 @@ def test_oversized_item_is_served_uncached():
276
item = MultiModalKwargsItem.dummy(nbytes=4096)
277
small = MultiModalKwargsItem.dummy(nbytes=64)
278
279
- p0_only = MultiModalProcessorOnlyCache(model_config) # type: ignore[arg-type]
279
+ p0_only = MultiModalProcessorOnlyCache(model_config)
280
assert p0_only.get_and_update_item((item, []), "big")[0] is item
281
assert not p0_only.is_cached_item("big")
282
assert p0_only.get_and_update_item((small, []), "small")[0] is small
283
assert p0_only.is_cached_item("small")
284
285
- p0 = LruKeyReplicatedSenderCache(model_config) # type: ignore[arg-type]
286
- p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type]
285
+ p0 = LruKeyReplicatedSenderCache(model_config)
286
+ p1 = LruKeyReplicatedReceiverCache(model_config)
287
assert item is not None
288
assert p0.get_and_update_item((item, []), "big")[0] is item
289
assert not p0.is_cached_item("big")
@@ -304,8 +304,8 @@ def test_mm_cache_miss_raises_and_recovers():
304
model or network.
305
"""
306
model_config = _StubModelConfig(mm_processor_cache_gb=1)
307
- p0 = LruKeyReplicatedSenderCache(model_config) # type: ignore[arg-type]
308
- p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type]
307
+ p0 = LruKeyReplicatedSenderCache(model_config)
308
+ p1 = LruKeyReplicatedReceiverCache(model_config)
309
310
mm_hash = "image_A"
311
item = MultiModalKwargsItem.dummy(nbytes=64)
@@ -348,7 +348,7 @@ def test_receiver_cache_replaces_stale_item_when_payload_resent():
348
and kills EngineCore. Prefer the fresh payload and keep it for later hits.
349
"""
350
model_config = _StubModelConfig(mm_processor_cache_gb=1)
351
- p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type]
351
+ p1 = LruKeyReplicatedReceiverCache(model_config)
352
small = MultiModalKwargsItem.dummy(nbytes=64)
353
large = MultiModalKwargsItem.dummy(nbytes=256)
354
mm_hash = "shared-id"
@@ -361,7 +361,7 @@ def test_receiver_cache_replaces_stale_item_when_payload_resent():
361
def test_receiver_cache_features_keep_resent_payload():
362
"""EngineCore updates features through get_and_update_features."""
363
model_config = _StubModelConfig(mm_processor_cache_gb=1)
364
- p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type]
364
+ p1 = LruKeyReplicatedReceiverCache(model_config)
365
small = MultiModalKwargsItem.dummy(nbytes=64)
366
large = MultiModalKwargsItem.dummy(nbytes=256)
367
mm_hash = "shared-id"
@@ -394,7 +394,7 @@ def test_mm_cache_miss_batches_all_drifted_hashes():
394
non-drifted items in the same request are still ingested.
395
"""
396
model_config = _StubModelConfig(mm_processor_cache_gb=1)
397
- p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type]
397
+ p1 = LruKeyReplicatedReceiverCache(model_config)
398
item = MultiModalKwargsItem.dummy(nbytes=64)
399
400
def _feature(
@@ -442,8 +442,8 @@ def test_shm_receiver_handles_prefix_covered_items(monkeypatch):
442
parallel_config=SimpleNamespace(world_size=1),
443
model_config=_StubModelConfig(mm_processor_cache_gb=4 * MiB_bytes / GiB_bytes),
444
)
445
- p0 = ShmObjectStoreSenderCache(vllm_config) # type: ignore[arg-type]
446
- p1 = ShmObjectStoreReceiverCache(vllm_config, mp.Lock()) # type: ignore[arg-type]
445
+ p0 = ShmObjectStoreSenderCache(vllm_config)
446
+ p1 = ShmObjectStoreReceiverCache(vllm_config, mp.Lock())
447
448
def _feature(
449
mm_hash: str, data: MultiModalKwargsItem | None
@@ -1082,9 +1082,9 @@ async def test_release_kv_cache_resends_mm_payload(use_async, release_error):
1082
1083
async def call_release():
1084
if use_async:
1085
- await AsyncLLM.release_kv_cache_memory(engine) # type: ignore[arg-type]
1085
+ await AsyncLLM.release_kv_cache_memory(engine)
1086
else:
1087
- LLMEngine.release_kv_cache_memory(engine) # type: ignore[arg-type]
1087
+ LLMEngine.release_kv_cache_memory(engine)
1088
1089
if release_error:
1090
with pytest.raises(RuntimeError, match=release_error):
tests/multimodal/test_processing.py
+4
-4
@@ -1281,7 +1281,7 @@ def test_get_supported_mm_processor_kwargs_uses_supported_modalities(
1281
processor: SimpleNamespace,
1282
expected: dict[str, set[str]],
1283
) -> None:
1284
- info = BaseProcessingInfo(SimpleNamespace()) # type: ignore[arg-type]
1284
+ info = BaseProcessingInfo(SimpleNamespace())
1285
info.__dict__["supported_mm_limits"] = supported_mm_limits
1286
monkeypatch.setattr(info, "get_hf_processor", lambda **_: processor)
1287
@@ -1291,7 +1291,7 @@ def test_get_supported_mm_processor_kwargs_uses_supported_modalities(
1291
def test_supported_mm_processor_kwargs_is_cached(
1292
monkeypatch: pytest.MonkeyPatch,
1293
) -> None:
1294
- info = BaseProcessingInfo(SimpleNamespace()) # type: ignore[arg-type]
1294
+ info = BaseProcessingInfo(SimpleNamespace())
1295
expected = {"images_kwargs": {"size"}}
1296
calls = 0
1297
@@ -1442,7 +1442,7 @@ def test_get_merged_mm_kwargs_treats_empty_scopes_as_absent_before_routing(
1442
mm_device_do_normalize=False,
1443
)
1444
model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config)
1445
- ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type]
1445
+ ctx = InputProcessingContext(model_config, tokenizer=None)
1446
1447
merged = ctx.get_merged_mm_kwargs(
1448
inference_kwargs,
@@ -1482,7 +1482,7 @@ def test_get_merged_mm_kwargs_merges_before_routing():
1482
mm_device_do_normalize=False,
1483
)
1484
model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config)
1485
- ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type]
1485
+ ctx = InputProcessingContext(model_config, tokenizer=None)
1486
1487
merged = ctx.get_merged_mm_kwargs(
1488
{
tests/multimodal/test_registry.py
+1
-1
@@ -24,4 +24,4 @@ def test_create_processor_error_uses_served_model_name():
24
ValueError,
25
match="friendly-model-name is not a multimodal model",
26
):
27
- MULTIMODAL_REGISTRY.create_processor(model_config) # type: ignore[arg-type]
27
+ MULTIMODAL_REGISTRY.create_processor(model_config)
tests/multimodal/test_video.py
+1
-1
@@ -493,7 +493,7 @@ def test_pynvvideocodec_failed_rebuild_invalidates_decoder_slot():
493
494
old_decoder = FakeDecoder()
495
slot = PyNvVideoCodecDecoderSlot(FakeStream())
496
- slot.decoder = old_decoder # type: ignore[assignment] # Fake retained GPU decoder.
496
+ slot.decoder = old_decoder
497
slot.source_path = "valid.mp4"
498
499
class FakeNvc:
tests/parser/cohere/test_structural_tags.py
+1
-1
@@ -347,7 +347,7 @@ class TestAdjustRequestFoldFromStructuredOutputs:
347
id="chat_completion_request",
348
),
349
pytest.param(
350
- lambda: StructuredOutputsParams(json=[1, 2, 3]), # type: ignore[arg-type]
350
+ lambda: StructuredOutputsParams(json=[1, 2, 3]),
351
id="structured_outputs_params",
352
),
353
],
tests/plugins_tests/bitsandbytes/test_bitsandbytes.py
+1
-1
@@ -271,7 +271,7 @@ def test_bitsandbytes_passes_revision_by_name():
271
return_value=["/folder/model.safetensors"],
272
),
273
):
274
- bnb.BitsAndBytesModelLoader._prepare_weights(fake_self, "org/model", "myrev") # type: ignore[arg-type]
274
+ bnb.BitsAndBytesModelLoader._prepare_weights(fake_self, "org/model", "myrev")
275
276
mock_idx.assert_called_once()
277
assert mock_idx.call_args.kwargs.get("revision") == "myrev"
tests/plugins_tests/bitsandbytes/test_transformers.py
+2
-2
@@ -43,7 +43,7 @@ def test_transformers_backend_quantization(
43
model,
44
model_impl="auto",
45
enforce_eager=True,
46
- **quantization_kwargs, # type: ignore[arg-type]
46
+ **quantization_kwargs,
47
) as vllm_model:
48
vllm_outputs = vllm_model.generate_greedy_logprobs(
49
example_prompts, max_tokens=max_tokens, num_logprobs=num_logprobs
@@ -53,7 +53,7 @@ def test_transformers_backend_quantization(
53
model,
54
model_impl="transformers",
55
enforce_eager=True,
56
- **quantization_kwargs, # type: ignore[arg-type]
56
+ **quantization_kwargs,
57
) as vllm_model:
58
model_config = vllm_model.llm.llm_engine.model_config
59
assert model_config.using_transformers_backend()
tests/plugins_tests/gguf/test_gguf_plugin_multimodal.py
+1
-1
@@ -92,7 +92,7 @@ def run_multimodal_gguf_test(
92
num_logprobs: int,
93
):
94
# Load images at runtime (inside subprocess) to avoid pickle issues
95
- images = [ImageAsset(name).pil_image for name in model.image_names] # type: ignore[arg-type]
95
+ images = [ImageAsset(name).pil_image for name in model.image_names]
96
size_factors = [0.25, 0.5, 1.0]
97
inputs_per_image = [
98
(
tests/plugins_tests/test_endpoint_plugins.py
+2
-2
@@ -172,7 +172,7 @@ async def test_init_state_is_noop_without_phase_a(monkeypatch: pytest.MonkeyPatc
172
monkeypatch.setenv("VLLM_PLUGINS", "dummy_admin_endpoint_plugin")
173
174
state = State()
175
- await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args()) # type: ignore[arg-type]
175
+ await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args())
176
177
assert not hasattr(state, "dummy_engine_client")
178
@@ -223,7 +223,7 @@ async def test_endpoint_plugin_end_to_end(monkeypatch: pytest.MonkeyPatch):
223
)
224
225
fake_engine_client = _FakeEngineClient(rpc_result=["cfg-a", "cfg-b"])
226
- await init_endpoint_plugins_state(fake_engine_client, app.state, args) # type: ignore[arg-type]
226
+ await init_endpoint_plugins_state(fake_engine_client, app.state, args)
227
228
assert app.state.dummy_engine_client is fake_engine_client
229
tests/plugins_tests/test_oot_registration_offline.py
+1
-1
@@ -92,7 +92,7 @@ def test_oot_registration_multimodal(
92
)
93
94
first_token = llm.get_tokenizer().decode(0)
95
- outputs = llm.generate(prompts, sampling_params) # type: ignore[arg-type]
95
+ outputs = llm.generate(prompts, sampling_params)
96
97
for output in outputs:
98
generated_text = output.outputs[0].text
tests/plugins_tests/test_stats_logger_plugins.py
+1
-1
@@ -24,7 +24,7 @@ def test_stat_logger_plugin_is_discovered(monkeypatch: pytest.MonkeyPatch):
24
vllm_config = VllmConfig()
25
instance = factories[0](vllm_config)
26
# The `is` check above narrows DummyStatLogger to a Callable
27
- assert isinstance(instance, DummyStatLogger) # type: ignore[arg-type]
27
+ assert isinstance(instance, DummyStatLogger)
28
29
30
def test_no_plugins_loaded_if_env_empty(monkeypatch: pytest.MonkeyPatch):
tests/quantization/test_auto_gptq.py
+2
-2
@@ -123,8 +123,8 @@ def test_auto_gptq_moe_creates_zero_initialized_expert_biases():
123
method = object.__new__(AutoGPTQMoEMethod)
124
method.quant_config = AutoGPTQConfig(4, 128, False, True, False, {}, {})
125
method.input_dtype = None
126
- method.experts_cls = None # type: ignore[assignment] # Weight creation does not select experts.
127
- method.moe = SimpleNamespace(w13_num_shards=2) # type: ignore[assignment]
126
+ method.experts_cls = None
127
+ method.moe = SimpleNamespace(w13_num_shards=2)
128
layer = torch.nn.Module()
129
130
method.create_weights(
tests/quantization/test_auto_round.py
+6
-6
@@ -423,7 +423,7 @@ def test_inc_get_quant_method_unquantized_routed_experts_with_model_prefix(
423
424
config = make_config(extra_config={"model.moe_layer": {"bits": 16}})
425
layer = object.__new__(RoutedExperts)
426
- layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub.
426
+ layer.moe_config = None
427
428
method = config.get_quant_method(layer, "moe_layer")
429
@@ -730,7 +730,7 @@ def test_wna16_cuda_low_bit_moe_routes_to_humming(monkeypatch, bits) -> None:
730
)
731
732
layer = object.__new__(RoutedExperts)
733
- layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
733
+ layer.moe_config = DummyMoeConfig()
734
layer_config = make_layer_config(bits=bits)
735
method = INCWna16Scheme().get_moe_method(
736
make_config(), layer, "model.layers.0.mlp", layer_config
@@ -861,7 +861,7 @@ def test_qwen3_30b_a3b_w4a16_autoround_routes_to_gptq_moe(
861
862
config = make_qwen3_autoround_config("qwen3_30b_a3b_w4a16")
863
layer = object.__new__(RoutedExperts)
864
- layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
864
+ layer.moe_config = DummyMoeConfig()
865
866
method = config.get_quant_method(layer, "model.layers.0.mlp")
867
@@ -890,7 +890,7 @@ def test_qwen3_30b_a3b_mxfp4_autoround_routes_to_mxfp4_moe(
890
891
config = make_qwen3_autoround_config("qwen3_30b_a3b_mxfp4")
892
layer = object.__new__(RoutedExperts)
893
- layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
893
+ layer.moe_config = DummyMoeConfig()
894
895
ignored_method = config.get_quant_method(
896
object.__new__(LinearBase), "model.layers.0.self_attn.q_proj"
@@ -1186,7 +1186,7 @@ def test_wna16_xpu_moe_routes_to_gptq_moe(monkeypatch) -> None:
1186
)
1187
1188
layer = object.__new__(RoutedExperts)
1189
- layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
1189
+ layer.moe_config = DummyMoeConfig()
1190
method = INCWna16Scheme().get_moe_method(
1191
make_config(),
1192
layer,
@@ -1669,7 +1669,7 @@ def test_inc_get_quant_method_unquantized_moe_returns_unquantized(
1669
when extra_config has bits >= 16."""
1670
config = make_config(extra_config={"layer": {"bits": 16}})
1671
layer = object.__new__(RoutedExperts)
1672
- layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub.
1672
+ layer.moe_config = None
1673
1674
class DummyUnquantizedFusedMoEMethod:
1675
def __init__(self, moe_config) -> None:
tests/quantization/test_fp8.py
+2
-2
@@ -220,7 +220,7 @@ def test_deepseek_v41_vl_mapper_routes_linear_scales(
220
quant_config=SimpleNamespace(weight_block_size=weight_block_size)
221
)
222
resolved = model_module._linear_scale_param_name(
223
- vllm_config, # type: ignore[arg-type]
223
+ vllm_config,
224
expert_dtype,
225
)
226
assert resolved == scale_name
@@ -798,7 +798,7 @@ def test_kv_cache_scale_sync_to_host_copies():
798
set_default_quant_scales(layer, register_buffer=True)
799
layer.kv_cache_dtype = "fp8"
800
801
- method = BaseKVCacheMethod(quant_config=None) # type: ignore[arg-type] # Scale synchronization does not use quant_config.
801
+ method = BaseKVCacheMethod(quant_config=None)
802
method.create_weights(layer)
803
# 0.3 stays != 1.0 even after the fp8_fnuz x2 rescale.
804
checkpoint_scale = torch.tensor(0.3, dtype=torch.float32)
tests/quantization/test_moe_wna16.py
+4
-4
@@ -218,9 +218,9 @@ def test_gptq_nfirst_weights_pass_through_for_triton():
218
219
def test_moe_wna16_setup_forwards_selected_backend(monkeypatch):
220
method = object.__new__(MoeWNA16Method)
221
- method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel.
221
+ method.experts_cls = object
222
method.wna16_backend = WNA16MoEBackend.HUMMING
223
- method.moe = object() # type: ignore[assignment] # Opaque mocked-config sentinel.
223
+ method.moe = object()
224
quant_config = object()
225
monkeypatch.setattr(
226
method, "get_fused_moe_quant_config", lambda layer: quant_config
@@ -235,7 +235,7 @@ def test_moe_wna16_setup_forwards_selected_backend(monkeypatch):
235
236
monkeypatch.setattr(moe_wna16, "make_wna16_moe_kernel", fake_make_wna16_moe_kernel)
237
238
- method._setup_kernel(layer) # type: ignore[arg-type] # Routing-table stub.
238
+ method._setup_kernel(layer)
239
240
assert method.moe_kernel is kernel
241
assert captured["backend"] == WNA16MoEBackend.HUMMING
@@ -280,7 +280,7 @@ def test_moe_wna16_uses_humming_quant_config(monkeypatch):
280
),
281
)
282
283
- assert method.get_fused_moe_quant_config(layer) is quant_config # type: ignore[arg-type] # Identity sentinel.
283
+ assert method.get_fused_moe_quant_config(layer) is quant_config
284
285
286
@pytest.mark.skipif(
tests/quantization/test_online.py
+4
-4
@@ -210,9 +210,9 @@ def test_online_nvfp4_reuses_kernel_when_weights_are_reprocessed(
210
monkeypatch,
211
) -> None:
212
method = object.__new__(Nvfp4OnlineMoEMethod)
213
- method.moe = SimpleNamespace(is_act_and_mul=True) # type: ignore[assignment]
214
- method.nvfp4_backend = object() # type: ignore[assignment] # Opaque mocked-backend sentinel.
215
- method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel.
213
+ method.moe = SimpleNamespace(is_act_and_mul=True)
214
+ method.nvfp4_backend = object()
215
+ method.experts_cls = object
216
method.moe_quant_config = None
217
method.moe_kernel = None
218
@@ -1432,7 +1432,7 @@ def test_online_int8_moe_w2_scale_matches_unsharded(monkeypatch) -> None:
1432
layer.w2_weight = torch.nn.Parameter(w2_in, requires_grad=False)
1433
layer.num_experts = layer.local_num_experts = w13.shape[0]
1434
method = SimpleNamespace(moe=SimpleNamespace(tp_size=moe_tp_size))
1435
- Int8OnlineMoEMethod._quantize_weights(method, layer) # type: ignore[arg-type]
1435
+ Int8OnlineMoEMethod._quantize_weights(method, layer)
1436
return layer.w2_weight, layer.w2_scale
1437
1438
full_weight, full_scale = quantize(w2, 1)
tests/quantization/test_quark.py
+2
-2
@@ -2314,7 +2314,7 @@ class TestQuarkInt4Format:
2314
None,
2315
quant_config.quant_config["global_quant_config"]["weight"],
2316
quant_config.pack_method,
2317
- moe_config, # type: ignore[arg-type]
2317
+ moe_config,
2318
)
2319
2320
layer = _FakeLayer(moe_config)
@@ -2326,7 +2326,7 @@ class TestQuarkInt4Format:
2326
requires_grad=False,
2327
)
2328
loader = method.get_weight_loader(
2329
- layer, # type: ignore[arg-type]
2329
+ layer,
2330
weight_loader=None,
2331
)
2332
loader(
tests/quantization/test_trtllm_nvfp4_hidden_dim_padding.py
+1
-1
@@ -34,7 +34,7 @@ def test_shared_nvfp4_input_scales_have_writable_storage(monkeypatch):
34
35
outputs = prepare_nvfp4_moe_layer_for_fi_or_cutlass(
36
backend=NvFp4MoeBackend.FLASHINFER_CUTLASS,
37
- layer=layer, # type: ignore[arg-type]
37
+ layer=layer,
38
w13=w13,
39
w13_scale=w13_scale,
40
w13_scale_2=weight_scale,
tests/quantization/test_turboquant.py
+1
-1
@@ -300,7 +300,7 @@ class TestTurboQuantKVCacheSpec:
300
301
# The layer builds an unpacked spec; the worker's spec-collection
302
# loop applies TQ slot packing via the backend's customize_spec hook.
303
- spec = Attention.get_kv_cache_spec(layer, vllm_config) # type: ignore[arg-type]
303
+ spec = Attention.get_kv_cache_spec(layer, vllm_config)
304
assert isinstance(spec, FullAttentionSpec)
305
assert spec.kv_quant_mode.is_turboquant
306
assert spec.state_content_bytes is None
tests/reasoning/test_base_thinking_reasoning_parser.py
+1
-1
@@ -68,7 +68,7 @@ class TestBaseThinkingReasoningParserInit:
68
def test_initialization_with_missing_tokenizer(self):
69
"""Test that initialization fails without tokenizer."""
70
with pytest.raises(ValueError, match="model tokenizer must be passed"):
71
- TestThinkingReasoningParser(None) # type: ignore[arg-type]
71
+ TestThinkingReasoningParser(None)
72
73
def test_initialization_with_missing_tokens(self, test_tokenizer):
74
"""Test that initialization fails when tokens are not in vocabulary."""
tests/renderers/test_cohere.py
+50
-50
@@ -81,7 +81,7 @@ class TestRoleToMelody:
81
# reject non-strings — any exception type is acceptable as long
82
# as we don't silently produce a malformed prompt.
83
with pytest.raises((AttributeError, TypeError, ValueError)):
84
- _role_to_melody(None) # type: ignore[arg-type]
84
+ _role_to_melody(None)
85
86
87
# ======================================================================
@@ -135,7 +135,7 @@ class TestNormalizeToolCall:
135
136
def test_invalid_type_rejected(self):
137
with pytest.raises(TypeError, match="Unexpected tool_call value"):
138
- _normalize_tool_call(42) # type: ignore[arg-type]
138
+ _normalize_tool_call(42)
139
140
141
# ======================================================================
@@ -249,7 +249,7 @@ class TestDocumentToMelody:
249
250
def test_invalid_type_rejected(self):
251
with pytest.raises(TypeError, match="Unsupported document type"):
252
- _document_to_melody(42) # type: ignore[arg-type]
252
+ _document_to_melody(42)
253
254
255
# ======================================================================
@@ -302,7 +302,7 @@ class TestToolToMelody:
302
303
def test_invalid_type_rejected(self):
304
with pytest.raises(TypeError, match="Unsupported tool type"):
305
- _tool_to_melody(42) # type: ignore[arg-type]
305
+ _tool_to_melody(42)
306
307
308
# ======================================================================
@@ -418,7 +418,7 @@ class TestConversationToMelody:
418
{"role": "user", "content": "hi"},
419
{"role": "assistant", "content": "hello"},
420
]
421
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
421
+ out = _conversation_to_melody_messages(conv)
422
assert out == [
423
{
424
"role": "user",
@@ -443,7 +443,7 @@ class TestConversationToMelody:
443
"reasoning": "thoughts",
444
}
445
]
446
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
446
+ out = _conversation_to_melody_messages(conv)
447
assert out[0]["content"] == [
448
{"type": MelodyContentType.THINKING, "thinking": "thoughts"},
449
{"type": MelodyContentType.TEXT, "text": "answer"},
@@ -457,7 +457,7 @@ class TestConversationToMelody:
457
"reasoning_content": "thoughts",
458
}
459
]
460
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
460
+ out = _conversation_to_melody_messages(conv)
461
assert out[0]["content"][0] == {
462
"type": MelodyContentType.THINKING,
463
"thinking": "thoughts",
@@ -474,7 +474,7 @@ class TestConversationToMelody:
474
"reasoning": "should be ignored",
475
}
476
]
477
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
477
+ out = _conversation_to_melody_messages(conv)
478
assert out[0]["content"] == [{"type": MelodyContentType.TEXT, "text": "hi"}]
479
480
def test_tool_calls_normalized(self):
@@ -491,7 +491,7 @@ class TestConversationToMelody:
491
],
492
}
493
]
494
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
494
+ out = _conversation_to_melody_messages(conv)
495
assert out[0]["tool_calls"] == [
496
{"id": "c1", "name": "f", "parameters": '{"a":1}'}
497
]
@@ -504,7 +504,7 @@ class TestConversationToMelody:
504
"tool_call_id": "c1",
505
}
506
]
507
- out = _conversation_to_melody_messages(conv) # type: ignore[arg-type]
507
+ out = _conversation_to_melody_messages(conv)
508
assert out[0]["tool_call_id"] == "c1"
509
510
def test_messages_citations_attached_by_index(self):
@@ -531,20 +531,20 @@ class TestConversationToMelody:
531
}
532
]
533
}
534
- out = _conversation_to_melody_messages(conv, citations) # type: ignore[arg-type]
534
+ out = _conversation_to_melody_messages(conv, citations)
535
assert "citations" not in out[0]
536
assert out[1]["citations"] == citations[1]
537
538
def test_messages_citations_none_is_a_no_op(self):
539
conv = [{"role": "assistant", "content": "a"}]
540
- out = _conversation_to_melody_messages(conv, None) # type: ignore[arg-type]
540
+ out = _conversation_to_melody_messages(conv, None)
541
assert "citations" not in out[0]
542
543
def test_messages_citations_missing_index_is_a_no_op(self):
544
# A ``messages_citations`` dict whose key doesn't hit any
545
# message must not attach anything (and must not raise).
546
conv = [{"role": "assistant", "content": "a"}]
547
- out = _conversation_to_melody_messages(conv, {5: [{"anything": 1}]}) # type: ignore[arg-type]
547
+ out = _conversation_to_melody_messages(conv, {5: [{"anything": 1}]})
548
assert "citations" not in out[0]
549
550
def test_tool_message_v2_content_replaces_default_content(self):
@@ -575,7 +575,7 @@ class TestConversationToMelody:
575
]
576
}
577
out = _conversation_to_melody_messages(
578
- conv, # type: ignore[arg-type]
578
+ conv,
579
tool_message_v2_content=v2_content,
580
)
581
# User message (no forwarded entry) still goes through the
@@ -597,7 +597,7 @@ class TestConversationToMelody:
597
]
598
}
599
out = _conversation_to_melody_messages(
600
- conv, # type: ignore[arg-type]
600
+ conv,
601
tool_message_v2_content=v2_content,
602
)
603
assert out[0]["content"] == [
@@ -607,7 +607,7 @@ class TestConversationToMelody:
607
def test_tool_message_v2_content_none_falls_back_to_default(self):
608
conv = [{"role": "tool", "tool_call_id": "c", "content": "plain text"}]
609
out = _conversation_to_melody_messages(
610
- conv, # type: ignore[arg-type]
610
+ conv,
611
tool_message_v2_content=None,
612
)
613
assert out[0]["content"] == [{"type": "text", "text": "plain text"}]
@@ -626,7 +626,7 @@ class TestBuildRenderConfig:
626
# Bare kwargs -> cmd4 (the current Command A+ prompt format).
627
# Mirrors ``_DEFAULT_FORMAT`` in ``vllm/renderers/cohere.py`` and
628
# the ``--cohere-format`` CLI default.
629
- fmt, cfg = _build_render_config(self._conv(), {}) # type: ignore[arg-type]
629
+ fmt, cfg = _build_render_config(self._conv(), {})
630
assert fmt == "cmd4"
631
assert cfg["use_jinja"] is True
632
assert isinstance(cfg["messages"], list)
@@ -634,12 +634,12 @@ class TestBuildRenderConfig:
634
assert "additional_template_fields" not in cfg
635
636
def test_explicit_cmd3(self):
637
- fmt, cfg = _build_render_config(self._conv(), {"cohere_format": "cmd3"}) # type: ignore[arg-type]
637
+ fmt, cfg = _build_render_config(self._conv(), {"cohere_format": "cmd3"})
638
assert fmt == "cmd3"
639
640
def test_invalid_format_raises(self):
641
with pytest.raises(ValueError, match="Invalid cohere_format"):
642
- _build_render_config(self._conv(), {"cohere_format": "cmd5"}) # type: ignore[arg-type]
642
+ _build_render_config(self._conv(), {"cohere_format": "cmd5"})
643
644
def test_documents_converted(self):
645
_, cfg = _build_render_config(
@@ -650,7 +650,7 @@ class TestBuildRenderConfig:
650
{"id": "d1", "data": {"text": "wrapped"}},
651
]
652
},
653
- ) # type: ignore[arg-type]
653
+ )
654
assert cfg["documents"] == [
655
{"text": "doc text"},
656
{"id": "d1", "text": "wrapped"},
@@ -665,7 +665,7 @@ class TestBuildRenderConfig:
665
{"type": "function", "function": {"name": "preferred"}}
666
],
667
},
668
- ) # type: ignore[arg-type]
668
+ )
669
names = [t["name"] for t in cfg["available_tools"]]
670
assert names == ["preferred"]
671
@@ -673,30 +673,30 @@ class TestBuildRenderConfig:
673
_, cfg = _build_render_config(
674
self._conv(),
675
{"tools": [{"type": "function", "function": {"name": "from_tools"}}]},
676
- ) # type: ignore[arg-type]
676
+ )
677
assert [t["name"] for t in cfg["available_tools"]] == ["from_tools"]
678
679
@pytest.mark.parametrize("value", ["enabled", "disabled"])
680
def test_reasoning_type_direct(self, value):
681
- _, cfg = _build_render_config(self._conv(), {"reasoning_type": value}) # type: ignore[arg-type]
681
+ _, cfg = _build_render_config(self._conv(), {"reasoning_type": value})
682
assert cfg["reasoning_type"] == value
683
684
def test_thinking_dict_shorthand_resolves_reasoning_type(self):
685
- _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "enabled"}}) # type: ignore[arg-type]
685
+ _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "enabled"}})
686
assert cfg["reasoning_type"] == "enabled"
687
688
def test_thinking_shorthand_ignores_unknown_type(self):
689
- _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "auto"}}) # type: ignore[arg-type]
689
+ _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "auto"}})
690
assert "reasoning_type" not in cfg
691
692
def test_dev_instruction_forwarded(self):
693
- _, cfg = _build_render_config(self._conv(), {"dev_instruction": "be brief"}) # type: ignore[arg-type]
693
+ _, cfg = _build_render_config(self._conv(), {"dev_instruction": "be brief"})
694
assert cfg["dev_instruction"] == "be brief"
695
696
def test_response_format_json_object_sets_json_mode(self):
697
_, cfg = _build_render_config(
698
self._conv(), {"response_format": {"type": "json_object"}}
699
- ) # type: ignore[arg-type]
699
+ )
700
assert cfg["json_mode"] is True
701
assert "json_schema" not in cfg
702
@@ -705,7 +705,7 @@ class TestBuildRenderConfig:
705
_, cfg = _build_render_config(
706
self._conv(),
707
{"response_format": {"type": "json_schema", "schema": schema}},
708
- ) # type: ignore[arg-type]
708
+ )
709
# JSON-encoded for melody (string-only schema field).
710
assert cfg["json_schema"] == json.dumps(schema)
711
@@ -721,35 +721,35 @@ class TestBuildRenderConfig:
721
"schema": {"schema": inner},
722
}
723
},
724
- ) # type: ignore[arg-type]
724
+ )
725
assert cfg["json_schema"] == json.dumps(inner)
726
727
def test_json_schema_kwarg_direct(self):
728
# Caller can also pass ``json_schema`` directly, both as dict and
729
# as a pre-stringified value.
730
- _, cfg = _build_render_config(self._conv(), {"json_schema": {"a": 1}}) # type: ignore[arg-type]
730
+ _, cfg = _build_render_config(self._conv(), {"json_schema": {"a": 1}})
731
assert cfg["json_schema"] == '{"a": 1}'
732
_, cfg = _build_render_config(
733
self._conv(), {"json_schema": "raw-string-schema"}
734
- ) # type: ignore[arg-type]
734
+ )
735
assert cfg["json_schema"] == "raw-string-schema"
736
737
def test_json_mode_kwarg_overrides(self):
738
- _, cfg = _build_render_config(self._conv(), {"json_mode": True}) # type: ignore[arg-type]
738
+ _, cfg = _build_render_config(self._conv(), {"json_mode": True})
739
assert cfg["json_mode"] is True
740
741
def test_cmd3_safety_mode_lowercased(self):
742
_, cfg = _build_render_config(
743
self._conv(),
744
{"cohere_format": "cmd3", "safety_mode": "CONTEXTUAL"},
745
- ) # type: ignore[arg-type]
745
+ )
746
assert cfg["safety_mode"] == "contextual"
747
748
def test_cmd3_citation_quality_direct(self):
749
_, cfg = _build_render_config(
750
self._conv(),
751
{"cohere_format": "cmd3", "citation_quality": "ACCURATE"},
752
- ) # type: ignore[arg-type]
752
+ )
753
assert cfg["citation_quality"] == "accurate"
754
755
def test_cmd3_citation_quality_derived_from_citation_options(self):
@@ -758,20 +758,20 @@ class TestBuildRenderConfig:
758
_, cfg = _build_render_config(
759
self._conv(),
760
{"cohere_format": "cmd3", "citation_options": {"mode": "accurate"}},
761
- ) # type: ignore[arg-type]
761
+ )
762
assert cfg["citation_quality"] == "on"
763
764
_, cfg = _build_render_config(
765
self._conv(),
766
{"cohere_format": "cmd3", "citation_options": {"mode": "off"}},
767
- ) # type: ignore[arg-type]
767
+ )
768
assert cfg["citation_quality"] == "off"
769
770
def test_cmd3_skip_preamble_forwarded(self):
771
_, cfg = _build_render_config(
772
self._conv(),
773
{"cohere_format": "cmd3", "skip_preamble": True},
774
- ) # type: ignore[arg-type]
774
+ )
775
assert cfg["skip_preamble"] is True
776
777
def test_cmd3_no_grounding_field(self):
@@ -779,7 +779,7 @@ class TestBuildRenderConfig:
779
_, cfg = _build_render_config(
780
self._conv(),
781
{"cohere_format": "cmd3", "grounding": "fast"},
782
- ) # type: ignore[arg-type]
782
+ )
783
assert "grounding" not in cfg
784
785
@pytest.mark.parametrize(
@@ -800,7 +800,7 @@ class TestBuildRenderConfig:
800
_, cfg = _build_render_config(
801
self._conv(),
802
{"cohere_format": "cmd4", "grounding": raw},
803
- ) # type: ignore[arg-type]
803
+ )
804
assert cfg["grounding"] == expected
805
806
@pytest.mark.parametrize(
@@ -818,7 +818,7 @@ class TestBuildRenderConfig:
818
"cohere_format": "cmd4",
819
"citation_options": {"mode": mode},
820
},
821
- ) # type: ignore[arg-type]
821
+ )
822
assert cfg["grounding"] == expected
823
824
def test_cmd4_grounding_rejects_unknown_value(self):
@@ -826,7 +826,7 @@ class TestBuildRenderConfig:
826
_build_render_config(
827
self._conv(),
828
{"cohere_format": "cmd4", "grounding": "foobar"},
829
- ) # type: ignore[arg-type]
829
+ )
830
831
def test_cmd4_platform_instruction(self):
832
_, cfg = _build_render_config(
@@ -835,7 +835,7 @@ class TestBuildRenderConfig:
835
"cohere_format": "cmd4",
836
"platform_instruction": "do this",
837
},
838
- ) # type: ignore[arg-type]
838
+ )
839
assert cfg["platform_instruction"] == "do this"
840
841
def test_cmd4_no_safety_mode_field(self):
@@ -847,7 +847,7 @@ class TestBuildRenderConfig:
847
"safety_mode": "contextual",
848
"citation_quality": "on",
849
},
850
- ) # type: ignore[arg-type]
850
+ )
851
assert "safety_mode" not in cfg
852
assert "citation_quality" not in cfg
853
@@ -862,7 +862,7 @@ class TestBuildRenderConfig:
862
"my_var": "x",
863
"documents": ["doc"], # consumed, must NOT leak through
864
},
865
- ) # type: ignore[arg-type]
865
+ )
866
extras = cfg["additional_template_fields"]
867
assert extras == {"reasoning_effort": "low", "my_var": "x"}
868
# Sanity: the consumed key still produced its dedicated config slot.
@@ -875,7 +875,7 @@ class TestBuildRenderConfig:
875
_, cfg = _build_render_config(
876
self._conv(),
877
{"template_id": "tpl1"},
878
- ) # type: ignore[arg-type]
878
+ )
879
assert cfg["template_id"] == "tpl1"
880
# use_jinja is always True, regardless of caller input.
881
assert cfg["use_jinja"] is True
@@ -896,7 +896,7 @@ class TestBuildRenderConfig:
896
_build_render_config(
897
self._conv(),
898
{cohere_only_key: "raw {{ jinja }}"},
899
- ) # type: ignore[arg-type]
899
+ )
900
901
@pytest.mark.parametrize("cohere_only_key", ["template_jinja", "template"])
902
def test_cohere_only_template_kwargs_none_is_tolerated(self, cohere_only_key):
@@ -906,7 +906,7 @@ class TestBuildRenderConfig:
906
_, cfg = _build_render_config(
907
self._conv(),
908
{cohere_only_key: None},
909
- ) # type: ignore[arg-type]
909
+ )
910
assert cohere_only_key not in cfg
911
assert "additional_template_fields" not in cfg
912
@@ -918,7 +918,7 @@ class TestBuildRenderConfig:
918
self._conv(),
919
{},
920
"raw {{ jinja }}",
921
- ) # type: ignore[arg-type]
921
+ )
922
assert cfg["template_jinja"] == "raw {{ jinja }}"
923
assert cfg["use_jinja"] is True
924
@@ -927,7 +927,7 @@ class TestBuildRenderConfig:
927
self._conv(),
928
{},
929
None,
930
- ) # type: ignore[arg-type]
930
+ )
931
assert "template_jinja" not in cfg
932
933
def test_tool_message_v2_content_key_picked_up_from_kwargs(self):
@@ -954,7 +954,7 @@ class TestBuildRenderConfig:
954
]
955
}
956
}
957
- _, cfg = _build_render_config(conv, kwargs) # type: ignore[arg-type]
957
+ _, cfg = _build_render_config(conv, kwargs)
958
tool_msg = cfg["messages"][1]
959
assert tool_msg["content"] == [{"type": "document", "document": {"r": "k"}}]
960
# And the key must be *consumed* -- not surfaced as a stray
tests/renderers/test_completions.py
+1
-1
@@ -139,7 +139,7 @@ class TestValidatePrompt:
139
140
with pytest.raises(TypeError, match="should be a list of integers"):
141
renderer.render_prompts(
142
- _preprocess_prompt(renderer.model_config, [[1, 2], ["foo", "bar"]]) # type: ignore[arg-type]
142
+ _preprocess_prompt(renderer.model_config, [[1, 2], ["foo", "bar"]])
143
)
144
145
tests/samplers/test_beam_search.py
+3
-3
@@ -113,7 +113,7 @@ def test_beam_search_abort_returns_partial_outputs_and_continues_other_prompts(
113
{"type": "token", "prompt_token_ids": [token]} for token in [prompt_token, 2]
114
]
115
params = BeamSearchParams(beam_width=2, max_tokens=3)
116
- outputs = llm.beam_search(prompts, params) # type: ignore[arg-type]
116
+ outputs = llm.beam_search(prompts, params)
117
118
aborted, normal = outputs
119
expected_tokens = (
@@ -326,7 +326,7 @@ def test_beam_search_structured_output(
326
327
llm = LLM(
328
model=model,
329
- dtype=dtype, # type: ignore[arg-type]
329
+ dtype=dtype,
330
max_model_len=512,
331
structured_outputs_config=dict(
332
backend="xgrammar",
@@ -345,7 +345,7 @@ def test_beam_search_structured_output(
345
"Generate a JSON object for a person with name and age:",
346
]
347
348
- outputs = llm.beam_search(prompts, params) # type: ignore[arg-type]
348
+ outputs = llm.beam_search(prompts, params)
349
350
assert len(outputs) == len(prompts)
351
for output in outputs:
tests/samplers/test_beam_search_online.py
+2
-2
@@ -57,8 +57,8 @@ class _EngineClient:
57
58
59
class _Serving(BeamSearchOnlineMixin):
60
- renderer = _Renderer() # type: ignore[assignment]
61
- engine_client = _EngineClient() # type: ignore[assignment]
60
+ renderer = _Renderer()
61
+ engine_client = _EngineClient()
62
63
64
@pytest.mark.asyncio
tests/standalone_tests/lazy_imports.py
+1
-1
@@ -17,6 +17,6 @@ module_names = ["torch._inductor.async_compile", "cv2"]
17
# if we import any modules during `import vllm`, there would be a
18
# hard error and nice stacktrace on the first import.
19
for module_name in module_names:
20
- sys.modules[module_name] = None # type: ignore[assignment]
20
+ sys.modules[module_name] = None
21
22
import vllm # noqa
tests/test_audio_media_size_precheck.py
+1
-1
@@ -144,6 +144,6 @@ async def test_audio_connector_threads_byte_limit_to_http_reader(
144
assert kwargs["max_bytes"] == MiB_bytes
145
raise VLLMValidationError("Maximum file size exceeded")
146
147
- connector = MediaConnector(connection=_Connection()) # type: ignore[arg-type]
147
+ connector = MediaConnector(connection=_Connection())
148
with pytest.raises(VLLMValidationError, match="Maximum file size exceeded"):
149
await connector.fetch_audio_async("https://example.test/audio")
tests/tokenizers_/test_mistral.py
+5
-5
@@ -975,7 +975,7 @@ class TestMistralTokenizer:
975
mistral_tokenizer: MistralTokenizer,
976
):
977
assert mistral_tokenizer.batch_decode(
978
- [[]], # type: ignore[arg-type]
978
+ [[]],
979
) == [""]
980
981
def test_convert_tokens_to_string(self, mistral_tokenizer: MistralTokenizer):
@@ -2246,7 +2246,7 @@ class TestMistralTokenizer:
2246
]
2247
2248
output = mistral_tokenizer.apply_chat_template(
2249
- messages, # type: ignore[arg-type]
2249
+ messages,
2250
add_generation_prompt=True,
2251
)
2252
decoded = mistral_tokenizer.tokenizer.decode(output, SpecialTokenPolicy.KEEP)
@@ -2352,7 +2352,7 @@ def test_v15_apply_chat_template_passes_reasoning_effort_high(
2352
)
2353
2354
v15_mistral_tokenizer.apply_chat_template(
2355
- messages=_PASSTHROUGH_MESSAGES, # type: ignore[arg-type]
2355
+ messages=_PASSTHROUGH_MESSAGES,
2356
reasoning_effort="high",
2357
)
2358
@@ -2375,7 +2375,7 @@ def test_v15_apply_chat_template_passes_reasoning_effort_none_by_default(
2375
fake_apply_chat_template,
2376
)
2377
2378
- v15_mistral_tokenizer.apply_chat_template(messages=_PASSTHROUGH_MESSAGES) # type: ignore[arg-type]
2378
+ v15_mistral_tokenizer.apply_chat_template(messages=_PASSTHROUGH_MESSAGES)
2379
2380
assert "reasoning_effort" in captured_kwargs[-1]
2381
assert captured_kwargs[-1]["reasoning_effort"] is None
@@ -2398,7 +2398,7 @@ def test_pre_v15_apply_chat_template_omits_reasoning_effort(
2398
)
2399
2400
v13_mistral_tokenizer.apply_chat_template(
2401
- messages=_PASSTHROUGH_MESSAGES, # type: ignore[arg-type]
2401
+ messages=_PASSTHROUGH_MESSAGES,
2402
reasoning_effort="high",
2403
)
2404
tests/tokenizers_/test_registry.py
+1
-1
@@ -205,7 +205,7 @@ def test_cached_tokenizer_from_config_registers_local_config(tmp_path: Path):
205
side_effect=lambda tokenizer: tokenizer,
206
),
207
):
208
- tokenizer = cached_tokenizer_from_config(model_config) # type: ignore[arg-type]
208
+ tokenizer = cached_tokenizer_from_config(model_config)
209
210
assert tokenizer.is_fast is True
211
finally:
tests/tool_parsers/test_ernie45_moe_tool_parser.py
+2
-2
@@ -54,7 +54,7 @@ def test_extract_tool_calls_no_tools(ernie45_tool_parser):
54
model_output = "This is a test"
55
extracted_tool_calls = ernie45_tool_parser.extract_tool_calls(
56
model_output, request=None
57
- ) # type: ignore[arg-type]
57
+ )
58
assert not extracted_tool_calls.tools_called
59
assert extracted_tool_calls.tool_calls == []
60
assert extracted_tool_calls.content == model_output
@@ -163,7 +163,7 @@ def test_extract_tool_calls(
163
):
164
extracted_tool_calls = ernie45_tool_parser.extract_tool_calls(
165
model_output, request=None
166
- ) # type: ignore[arg-type]
166
+ )
167
assert extracted_tool_calls.tools_called
168
169
assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls)
tests/tool_parsers/test_jamba_tool_parser.py
+3
-3
@@ -78,7 +78,7 @@ def stream_delta_message_generator(
78
previous_token_ids,
79
current_token_ids,
80
delta_token_ids,
81
- request=None, # type: ignore[arg-type]
81
+ request=None,
82
)
83
if delta_message:
84
yield delta_message
@@ -95,7 +95,7 @@ def test_extract_tool_calls_no_tools(jamba_tool_parser):
95
model_output = "This is a test"
96
extracted_tool_calls = jamba_tool_parser.extract_tool_calls(
97
model_output, request=None
98
- ) # type: ignore[arg-type]
98
+ )
99
assert not extracted_tool_calls.tools_called
100
assert extracted_tool_calls.tool_calls == []
101
assert extracted_tool_calls.content == model_output
@@ -166,7 +166,7 @@ def test_extract_tool_calls(
166
):
167
extracted_tool_calls = jamba_tool_parser.extract_tool_calls(
168
model_output, request=None
169
- ) # type: ignore[arg-type]
169
+ )
170
assert extracted_tool_calls.tools_called
171
172
assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls)
tests/tool_parsers/test_qwen3coder_tool_parser.py
+1
-1
@@ -225,7 +225,7 @@ def test_extract_tool_calls_no_tools(qwen3_tool_parser):
225
model_output = "This is a test response without any tool calls"
226
extracted_tool_calls = qwen3_tool_parser.extract_tool_calls(
227
model_output, request=None
228
- ) # type: ignore[arg-type]
228
+ )
229
assert not extracted_tool_calls.tools_called
230
assert extracted_tool_calls.tool_calls == []
231
assert extracted_tool_calls.content == model_output
tests/tool_parsers/test_step3p5_tool_parser.py
+1
-1
@@ -170,7 +170,7 @@ def test_extract_tool_calls_no_tools(step3p5_tool_parser):
170
model_output = "This is a test response without any tool calls"
171
extracted_tool_calls = step3p5_tool_parser.extract_tool_calls(
172
model_output, request=None
173
- ) # type: ignore[arg-type]
173
+ )
174
assert not extracted_tool_calls.tools_called
175
assert extracted_tool_calls.tool_calls == []
176
assert extracted_tool_calls.content == model_output
tests/tool_parsers/test_xlam_tool_parser.py
+4
-4
@@ -100,7 +100,7 @@ def test_extract_tool_calls_no_tools(xlam_tool_parser):
100
model_output = "This is a test"
101
extracted_tool_calls = xlam_tool_parser.extract_tool_calls(
102
model_output, request=None
103
- ) # type: ignore[arg-type]
103
+ )
104
assert not extracted_tool_calls.tools_called
105
assert extracted_tool_calls.tool_calls == []
106
assert extracted_tool_calls.content == model_output
@@ -225,7 +225,7 @@ def test_extract_tool_calls(
225
):
226
extracted_tool_calls = xlam_tool_parser.extract_tool_calls(
227
model_output, request=None
228
- ) # type: ignore[arg-type]
228
+ )
229
assert extracted_tool_calls.tools_called
230
231
assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls)
@@ -263,7 +263,7 @@ def test_extract_tool_calls_list_structure(
263
"""Test extraction of tool calls when the model outputs a list-structured tool call.""" # noqa: E501
264
extracted_tool_calls = xlam_tool_parser.extract_tool_calls(
265
model_output, request=None
266
- ) # type: ignore[arg-type]
266
+ )
267
assert extracted_tool_calls.tools_called
268
269
assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls)
@@ -550,7 +550,7 @@ def test_extract_tool_calls_non_ascii(xlam_tool_parser, xlam_tokenizer, streamin
550
if delta.tool_calls and delta.tool_calls[0].function.arguments
551
)
552
else:
553
- extracted = xlam_tool_parser.extract_tool_calls(model_output, request=None) # type: ignore[arg-type]
553
+ extracted = xlam_tool_parser.extract_tool_calls(model_output, request=None)
554
args = "".join(tc.function.arguments for tc in extracted.tool_calls)
555
556
assert "北京" in args
tests/tool_use/test_gemma4_responses_adjust_request.py
+1
-1
@@ -148,7 +148,7 @@ def test_tool_parser_adjust_request_builds_valid_response_text_config() -> None:
148
description string that the previous two-step construction injected.
149
"""
150
parser = ToolParser.__new__(ToolParser)
151
- parser.model_tokenizer = None # type: ignore[assignment]
151
+ parser.model_tokenizer = None
152
153
request = _build_responses_request(tool_choice="required")
154
ToolParser.adjust_request(parser, request)
tests/tool_use/test_kimi_k3_tool_parser.py
+1
-1
@@ -370,7 +370,7 @@ def test_streaming_split_markers_do_not_leak():
370
assert len(tool_deltas) == 1
371
assert tool_deltas[0].function is not None
372
assert tool_deltas[0].function.name == "calc"
373
- assert json.loads(tool_deltas[0].function.arguments) == {"x": 1} # type: ignore[arg-type]
373
+ assert json.loads(tool_deltas[0].function.arguments) == {"x": 1}
374
375
376
def test_tool_call_ids_are_unique_across_messages():
tests/transformers_utils/processors/test_voxtral.py
+1
-1
@@ -98,7 +98,7 @@ def test_fetch_audio_rejects_unsupported_type(
98
feature_extractor: MistralCommonFeatureExtractor,
99
):
100
with pytest.raises(TypeError, match="only a numpy array"):
101
- feature_extractor.fetch_audio(42) # type: ignore[arg-type]
101
+ feature_extractor.fetch_audio(42)
102
103
104
def test_fetch_audio_str_delegates_to_load_audio(
tests/transformers_utils/test_processor.py
+2
-2
@@ -44,7 +44,7 @@ class _ProcWithUnpack:
44
45
def test_get_processor_kwargs_from_processor_unpack_path_returns_full_union():
46
proc = _ProcWithUnpack()
47
- keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) # type: ignore[arg-type]
47
+ keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc))
48
_assert_has_all_expected(keys)
49
50
@@ -63,5 +63,5 @@ def test_get_processor_kwargs_from_processor_module_scan_returns_full_union():
63
assert hasattr(mod, "_FakeProcessorKwargs")
64
65
proc = _ProcWithoutUnpack()
66
- keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) # type: ignore[arg-type]
66
+ keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc))
67
_assert_has_all_expected(keys)
tests/utils.py
+1
-1
@@ -830,7 +830,7 @@ class RemoteOpenAIServerCustom(RemoteOpenAIServer):
830
self.proc: Process = cast(Any, ctx).Process(
831
target=_run_in_new_process_group,
832
args=(self.child_process_fxn, env_dict, model, vllm_serve_args),
833
- ) # type: ignore[assignment]
833
+ )
834
with _temporarily_sanitized_pythonpath_env():
835
self.proc.start()
836
tests/utils_/test_argparse_utils.py
+9
-9
@@ -476,32 +476,32 @@ def test_compilation_config_mode_validator():
476
"""Test that CompilationConfig.mode field validator converts strings to integers."""
477
from vllm.config.compilation import CompilationConfig, CompilationMode
478
479
- config = CompilationConfig(mode=0) # type: ignore[arg-type]
479
+ config = CompilationConfig(mode=0)
480
assert config.mode == CompilationMode.NONE
481
482
- config = CompilationConfig(mode=3) # type: ignore[arg-type]
482
+ config = CompilationConfig(mode=3)
483
assert config.mode == CompilationMode.VLLM_COMPILE
484
485
- config = CompilationConfig(mode="NONE") # type: ignore[arg-type]
485
+ config = CompilationConfig(mode="NONE")
486
assert config.mode == CompilationMode.NONE
487
488
- config = CompilationConfig(mode="STOCK_TORCH_COMPILE") # type: ignore[arg-type]
488
+ config = CompilationConfig(mode="STOCK_TORCH_COMPILE")
489
assert config.mode == CompilationMode.STOCK_TORCH_COMPILE
490
491
- config = CompilationConfig(mode="DYNAMO_TRACE_ONCE") # type: ignore[arg-type]
491
+ config = CompilationConfig(mode="DYNAMO_TRACE_ONCE")
492
assert config.mode == CompilationMode.DYNAMO_TRACE_ONCE
493
494
- config = CompilationConfig(mode="VLLM_COMPILE") # type: ignore[arg-type]
494
+ config = CompilationConfig(mode="VLLM_COMPILE")
495
assert config.mode == CompilationMode.VLLM_COMPILE
496
497
- config = CompilationConfig(mode="none") # type: ignore[arg-type]
497
+ config = CompilationConfig(mode="none")
498
assert config.mode == CompilationMode.NONE
499
500
- config = CompilationConfig(mode="vllm_compile") # type: ignore[arg-type]
500
+ config = CompilationConfig(mode="vllm_compile")
501
assert config.mode == CompilationMode.VLLM_COMPILE
502
503
with pytest.raises(ValidationError, match="Invalid compilation mode"):
504
- CompilationConfig(mode="INVALID_MODE") # type: ignore[arg-type]
504
+ CompilationConfig(mode="INVALID_MODE")
505
506
507
def test_flat_product():
tests/v1/attention/test_mla_prefill_selector.py
+2
-2
@@ -511,14 +511,14 @@ class TestMLAPrefillBackendParsing:
511
512
def test_valid_string_parses_to_enum(self):
513
config = AttentionConfig(
514
- mla_prefill_backend="FLASH_ATTN", # type: ignore[arg-type]
514
+ mla_prefill_backend="FLASH_ATTN",
515
)
516
assert config.mla_prefill_backend == MLAPrefillBackendEnum.FLASH_ATTN
517
518
def test_invalid_string_raises_error(self):
519
with pytest.raises(ValueError, match="Unknown MLA prefill backend"):
520
AttentionConfig(
521
- mla_prefill_backend="NONEXISTENT", # type: ignore[arg-type]
521
+ mla_prefill_backend="NONEXISTENT",
522
)
523
524
tests/v1/attention/test_sparse_mla_backends.py
+3
-3
@@ -3575,7 +3575,7 @@ def test_flashmla_fp8_paths_accept_decode_subset(monkeypatch, use_mixed_batch: b
3575
3576
if use_mixed_batch:
3577
fp8_metadata = FlashMLASparseMetadata.FP8KernelMetadata(
3578
- scheduler_metadata=object(), # type: ignore[arg-type]
3578
+ scheduler_metadata=object(),
3579
dummy_block_table=torch.empty(1, 1, dtype=torch.int32, device=DEVICE_TYPE),
3580
cache_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE),
3581
)
@@ -3588,7 +3588,7 @@ def test_flashmla_fp8_paths_accept_decode_subset(monkeypatch, use_mixed_batch: b
3588
num_prefill_tokens=num_batch_tokens - num_decode_tokens,
3589
decode=FP8Meta.Decode(
3590
seq_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE),
3591
- kernel_metadata=object(), # type: ignore[arg-type]
3591
+ kernel_metadata=object(),
3592
decode_query_len=num_decode_tokens,
3593
),
3594
prefill=FP8Meta.Prefill(
@@ -3774,7 +3774,7 @@ def test_fp8_mixed_batch_dcp_neutralizes_empty_rows(monkeypatch):
3774
3775
metadata = SimpleNamespace(
3776
fp8_extra_metadata=FlashMLASparseMetadata.FP8KernelMetadata(
3777
- scheduler_metadata=object(), # type: ignore[arg-type]
3777
+ scheduler_metadata=object(),
3778
dummy_block_table=torch.empty(1, 1, dtype=torch.int32, device=DEVICE_TYPE),
3779
cache_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE),
3780
),
tests/v1/cudagraph/test_cudagraph_manager.py
+2
-2
@@ -134,7 +134,7 @@ def test_piecewise_capture_uses_pcp_dummy_slot_mappings():
134
device=torch.device("cpu"),
135
max_num_reqs=num_reqs,
136
max_num_tokens=num_tokens,
137
- block_tables=pcp_block_tables, # type: ignore[arg-type]
137
+ block_tables=pcp_block_tables,
138
)
139
140
block_tables = MagicMock()
@@ -224,7 +224,7 @@ def test_speculator_capture_preserves_decode_query_bounds(
224
)
225
manager = SpeculatorCudaGraphManager.__new__(SpeculatorCudaGraphManager)
226
manager.max_num_reqs = num_reqs
227
- manager.vllm_config = SimpleNamespace( # type: ignore[assignment]
227
+ manager.vllm_config = SimpleNamespace(
228
parallel_config=SimpleNamespace(data_parallel_size=1)
229
)
230
buffers = InputBuffers(num_reqs, num_tokens, torch.device("cpu"))
tests/v1/cudagraph/test_encoder_cudagraph.py
+4
-4
@@ -652,7 +652,7 @@ def test_eonly_capture_preserves_outputs_across_replay_and_fallback(profile_only
652
encoder.device = device
653
encoder.cudagraph_manager = manager
654
runner = object.__new__(MMEncoderModelRunner)
655
- runner.model_state = SimpleNamespace(encoder_runner=encoder) # type: ignore[assignment]
655
+ runner.model_state = SimpleNamespace(encoder_runner=encoder)
656
# No decoder manager is installed: capture must be encoder-only.
657
with patch(
658
"vllm.v1.worker.mm_encoder_model_runner.lock_workspace", wraps=lock_workspace
@@ -673,7 +673,7 @@ def test_eonly_capture_preserves_outputs_across_replay_and_fallback(profile_only
673
with patch(
674
"vllm.v1.worker.gpu.ec_connector.get_ec_transfer", return_value=connector
675
):
676
- ec = ActiveECConnector(SimpleNamespace(), cache) # type: ignore[arg-type]
676
+ ec = ActiveECConnector(SimpleNamespace(), cache)
677
scheduled = cast(
678
SchedulerOutput,
679
SimpleNamespace(
@@ -716,7 +716,7 @@ def test_eonly_without_encoder_graph_skips_capture():
716
encoder = object.__new__(EncoderRunner)
717
encoder.cudagraph_manager = None
718
runner = object.__new__(MMEncoderModelRunner)
719
- runner.model_state = SimpleNamespace(encoder_runner=encoder) # type: ignore[assignment]
719
+ runner.model_state = SimpleNamespace(encoder_runner=encoder)
720
assert runner.capture_model() == 0
721
722
@@ -1023,7 +1023,7 @@ class TestInitInvariantValidation:
1023
vllm_config = _MockVllmConfig(token_budgets, max_mm_items)
1024
model = _MockModel(min_budget, max_budget)
1025
return EncoderCudaGraphManager(
1026
- vllm_config=vllm_config, # type: ignore[arg-type]
1026
+ vllm_config=vllm_config,
1027
device=torch.device("cpu"),
1028
dtype=torch.float32,
1029
model=model,
tests/v1/distributed/test_eagle_dp.py
+1
-1
@@ -61,7 +61,7 @@ async def test_run_eagle_dp(monkeypatch: pytest.MonkeyPatch, attn_backend: str):
61
data_parallel_backend="mp", # ray takes more time
62
trust_remote_code=True,
63
max_model_len=16384,
64
- attention_config={"backend": attn_backend}, # type: ignore[arg-type]
64
+ attention_config={"backend": attn_backend},
65
)
66
67
eagle_engine_args = replace(
tests/v1/engine/test_startup_watch_processes.py
+2
-2
@@ -304,9 +304,9 @@ def test_wait_for_engine_startup_reports_watched_process_exit():
304
wait_for_engine_startup(
305
handshake_socket,
306
[CoreEngine()],
307
- parallel_config, # type: ignore[arg-type]
307
+ parallel_config,
308
coordinated_dp=False,
309
- cache_config=None, # type: ignore[arg-type]
309
+ cache_config=None,
310
launch=launch,
311
)
312
finally:
tests/v1/executor/test_executor.py
+2
-2
@@ -126,7 +126,7 @@ def test_custom_executor_type_checking():
126
model=MODEL,
127
gpu_memory_utilization=0.2,
128
max_model_len=8192,
129
- distributed_executor_backend=Mock, # type: ignore[arg-type]
129
+ distributed_executor_backend=Mock,
130
)
131
LLMEngine.from_engine_args(engine_args)
132
with pytest.raises(ValueError):
@@ -134,7 +134,7 @@ def test_custom_executor_type_checking():
134
model=MODEL,
135
gpu_memory_utilization=0.2,
136
max_model_len=8192,
137
- distributed_executor_backend=Mock, # type: ignore[arg-type]
137
+ distributed_executor_backend=Mock,
138
)
139
AsyncLLM.from_engine_args(engine_args)
140
tests/v1/kv_connector/unit/offloading_connector/test_metrics.py
+9
-9
@@ -480,7 +480,7 @@ def test_reset():
480
481
def test_prom_metrics_observes_manager_counter():
482
prom_metrics = OffloadPromMetrics(
483
- vllm_config=_FakeVllmConfig(), # type: ignore[arg-type]
483
+ vllm_config=_FakeVllmConfig(),
484
metric_types={
485
Gauge: _FakeMetric,
486
Counter: _FakeMetric,
@@ -506,7 +506,7 @@ def test_prom_metrics_observes_manager_counter():
506
507
def test_prom_metrics_observes_flat_transfer_metrics_and_legacy_metrics():
508
prom_metrics = OffloadPromMetrics(
509
- vllm_config=_FakeVllmConfig(), # type: ignore[arg-type]
509
+ vllm_config=_FakeVllmConfig(),
510
metric_types={
511
Gauge: _FakeMetric,
512
Counter: _FakeMetric,
@@ -568,7 +568,7 @@ def test_prom_metrics_observes_manager_gauge_and_histogram():
568
return_value=_spec_cls_with_metric_definitions(metric_definitions),
569
):
570
prom_metrics = OffloadPromMetrics(
571
- vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type]
571
+ vllm_config=_FakeVllmConfig(store_threshold=0),
572
metric_types={
573
Gauge: _FakeMetric,
574
Counter: _FakeMetric,
@@ -612,7 +612,7 @@ def test_prom_metrics_lazily_observes_labeled_metric():
612
return_value=_spec_cls_with_metric_definitions(metric_definitions),
613
):
614
prom_metrics = OffloadPromMetrics(
615
- vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type]
615
+ vllm_config=_FakeVllmConfig(store_threshold=0),
616
metric_types={
617
Gauge: _FakeMetric,
618
Counter: _FakeMetric,
@@ -651,7 +651,7 @@ def test_prom_metrics_rejects_wrong_label_count():
651
return_value=_spec_cls_with_metric_definitions(metric_definitions),
652
):
653
prom_metrics = OffloadPromMetrics(
654
- vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type]
654
+ vllm_config=_FakeVllmConfig(store_threshold=0),
655
metric_types={
656
Gauge: _FakeMetric,
657
Counter: _FakeMetric,
@@ -672,7 +672,7 @@ def test_prom_metrics_rejects_wrong_label_count():
672
673
def test_prom_metrics_uses_configured_manager_metrics():
674
prom_metrics = OffloadPromMetrics(
675
- vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type]
675
+ vllm_config=_FakeVllmConfig(store_threshold=0),
676
metric_types={
677
Gauge: _FakeMetric,
678
Counter: _FakeMetric,
@@ -693,7 +693,7 @@ def test_prom_metrics_registers_tiering_metrics_from_spec():
693
"spec_name": "TieringOffloadingSpec",
694
"secondary_tiers": [],
695
},
696
- ), # type: ignore[arg-type]
696
+ ),
697
metric_types={
698
Gauge: _FakeMetric,
699
Counter: _FakeMetric,
@@ -741,7 +741,7 @@ def test_aggregate_into_empty_stats():
741
def test_prom_metrics_multi_engine_routing():
742
"""Metrics are routed to the correct engine index."""
743
prom_metrics = OffloadPromMetrics(
744
- vllm_config=_FakeVllmConfig(), # type: ignore[arg-type]
744
+ vllm_config=_FakeVllmConfig(),
745
metric_types={
746
Gauge: _FakeMetric,
747
Counter: _FakeMetric,
@@ -767,7 +767,7 @@ def test_prom_metrics_multi_engine_routing():
767
def test_prom_metrics_rejects_undeclared_metric():
768
"""observe() asserts if a metric was never declared in metadata."""
769
prom_metrics = OffloadPromMetrics(
770
- vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type]
770
+ vllm_config=_FakeVllmConfig(store_threshold=0),
771
metric_types={
772
Gauge: _FakeMetric,
773
Counter: _FakeMetric,
tests/v1/kv_connector/unit/test_mooncake_store_worker.py
+1
-1
@@ -1543,7 +1543,7 @@ def test_store_sending_thread_reports_job_when_the_preamble_raises():
1543
# every dequeue leaves through the same exit.
1544
thread = _make_store_sending_thread(MagicMock())
1545
req = _make_store_req("req-a", [b"a0", b"a1"])
1546
- req.token_len_chunk = None # type: ignore[assignment]
1546
+ req.token_len_chunk = None
1547
1548
with contextlib.suppress(TypeError):
1549
_run_store_req(thread, req)
tests/v1/kv_connector/unit/test_nixl_connector.py
+1
-1
@@ -114,7 +114,7 @@ def get_default_xfer_telemetry(
114
class AttributeDict(dict):
115
__slots__ = ()
116
__getattr__ = dict.__getitem__
117
- __setattr__ = dict.__setitem__ # type: ignore[assignment]
117
+ __setattr__ = dict.__setitem__
118
119
# We can't instantiate nixlXferTelemetry because it's read only and
120
# ray env does not have NIXL, so we must fake it
tests/v1/kv_connector/unit/test_nixl_push_connector.py
+1
-1
@@ -1256,7 +1256,7 @@ class TestPushWriterNegative:
1256
w = _StubWriterWorker.fresh()
1257
for bogus_rid in (123, None, 4.5, b"bytes-not-str"):
1258
payload = _registration_data("placeholder")
1259
- payload["request_id"] = bogus_rid # type: ignore[assignment]
1259
+ payload["request_id"] = bogus_rid
1260
notif = PUSH_REG_NOTIF_PREFIX + msgspec.msgpack.encode(payload)
1261
w._handle_push_reg_notif(notif)
1262
assert w._pending_d_registrations == {}
tests/v1/kv_offload/tiering/p2p/test_manager.py
+41
-41
@@ -349,10 +349,10 @@ class TestServeExternalRequests:
349
mgr._failed_serve_ctxs = [ctx]
350
sess_a = _RecordingSession()
351
sess_b = _RecordingSession()
352
- mgr._sessions = {"a": sess_a, "b": sess_b} # type: ignore[assignment]
352
+ mgr._sessions = {"a": sess_a, "b": sess_b}
353
354
parent = _RecordingParent()
355
- mgr.serve_external_requests(parent) # type: ignore[arg-type]
355
+ mgr.serve_external_requests(parent)
356
357
# Failed serve released and queue cleared.
358
assert parent.finished == ["p2p:peer:req-1:lu1"]
@@ -364,10 +364,10 @@ class TestServeExternalRequests:
364
def test_no_failed_serves_still_serves_sessions(self):
365
mgr = _make_manager()
366
sess = _RecordingSession()
367
- mgr._sessions = {"a": sess} # type: ignore[assignment]
367
+ mgr._sessions = {"a": sess}
368
369
parent = _RecordingParent()
370
- mgr.serve_external_requests(parent) # type: ignore[arg-type]
370
+ mgr.serve_external_requests(parent)
371
372
assert parent.finished == []
373
assert sess.served_with == [parent]
@@ -427,7 +427,7 @@ class TestSubmitStore:
427
forwards directly to that session rather than re-buffering."""
428
mgr = _make_manager()
429
bound = _FakeSession(peer_id="10.0.0.1:8000", connected=True)
430
- mgr._kv_to_session["req-1"] = bound # type: ignore[assignment]
430
+ mgr._kv_to_session["req-1"] = bound
431
# Note: _sessions is intentionally untouched — this test isolates
432
# the kv_request_id → session fast path.
433
job = _job_metadata(
@@ -495,7 +495,7 @@ class TestSubmitLoad:
495
mgr = _make_manager()
496
peer_id = "10.0.0.1:8000"
497
existing = _FakeSession(peer_id=peer_id, connected=True)
498
- mgr._sessions[peer_id] = existing # type: ignore[assignment]
498
+ mgr._sessions[peer_id] = existing
499
job = _job_metadata(
500
job_id=42,
501
keys=[b"k1", b"k2"],
@@ -581,7 +581,7 @@ class TestOnRequestFinished:
581
(FetchMsg received) routes via _kv_to_session and pops the entry."""
582
mgr = _make_manager()
583
bound = _FakeSession(peer_id="some-peer:1", connected=True)
584
- mgr._kv_to_session["req-1"] = bound # type: ignore[assignment]
584
+ mgr._kv_to_session["req-1"] = bound
585
ctx = _req_context(kv_params=_remote_decoder_kv_params(kv_request_id="req-1"))
586
mgr.on_request_finished(ctx)
587
assert bound.finishes == ["req-1"]
@@ -718,8 +718,8 @@ class TestGetFinished:
718
def poll(self):
719
return []
720
721
- mgr._control = FakeControl() # type: ignore[assignment]
722
- mgr._data = None # type: ignore[assignment]
721
+ mgr._control = FakeControl()
722
+ mgr._data = None
723
return mgr
724
725
def test_drains_finished_jobs(self):
@@ -740,7 +740,7 @@ class TestGetFinished:
740
pass
741
742
mgr = self._make()
743
- mgr._data = FakeData() # type: ignore[assignment]
743
+ mgr._data = FakeData()
744
dead = _FakeSession(
745
peer_id="dead:1234",
746
alive=False,
@@ -749,7 +749,7 @@ class TestGetFinished:
749
close_req_ids=["req-load"],
750
close_stores=[10, 11],
751
)
752
- mgr._sessions["dead:1234"] = dead # type: ignore[assignment]
752
+ mgr._sessions["dead:1234"] = dead
753
754
results = list(mgr.get_finished_jobs())
755
# 2 baseline + 1 failed load + 2 failed stores
@@ -769,14 +769,14 @@ class TestGetFinished:
769
pass
770
771
mgr = self._make()
772
- mgr._data = FakeData() # type: ignore[assignment]
772
+ mgr._data = FakeData()
773
dead = _FakeSession(
774
peer_id="dead:1234",
775
alive=False,
776
connected=True,
777
close_req_ids=["req-probe-1", "req-probe-2"],
778
)
779
- mgr._sessions["dead:1234"] = dead # type: ignore[assignment]
779
+ mgr._sessions["dead:1234"] = dead
780
781
list(mgr.get_finished_jobs())
782
assert "dead:1234" not in mgr._sessions
@@ -854,7 +854,7 @@ class TestHasPendingWork:
854
"""The result is the same regardless of session state — there is
855
no 'idle' branch."""
856
mgr = _make_manager()
857
- mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") # type: ignore[assignment]
857
+ mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1")
858
assert mgr.has_pending_work() is True
859
860
@@ -919,12 +919,12 @@ class TestShutdownDrain:
919
mgr = _make_manager()
920
data = _ShutdownFakeData(still_queue=still_queue)
921
control = _ShutdownFakeControl()
922
- mgr._data = data # type: ignore[assignment]
923
- mgr._control = control # type: ignore[assignment]
922
+ mgr._data = data
923
+ mgr._control = control
924
if inflight_ids:
925
session = _FakeSession(peer_id="peer:1", connected=True)
926
session._server._inflight = {tid: object() for tid in inflight_ids}
927
- mgr._sessions["peer:1"] = session # type: ignore[assignment]
927
+ mgr._sessions["peer:1"] = session
928
return mgr, data, control
929
930
def test_shutdown_drains_inflight_via_wait_cancel(self):
@@ -1148,10 +1148,10 @@ def _build_paired_managers() -> tuple[P2PSecondaryTierManager, P2PSecondaryTierM
1148
ctrl_b = _LoopbackControl(mgr_b._local_id)
1149
ctrl_a.pair(ctrl_b)
1150
1151
- mgr_a._control = ctrl_a # type: ignore[assignment]
1152
- mgr_b._control = ctrl_b # type: ignore[assignment]
1153
- mgr_a._data = _FakeData(mgr_a._local_id) # type: ignore[assignment]
1154
- mgr_b._data = _FakeData(mgr_b._local_id) # type: ignore[assignment]
1151
+ mgr_a._control = ctrl_a
1152
+ mgr_b._control = ctrl_b
1153
+ mgr_a._data = _FakeData(mgr_a._local_id)
1154
+ mgr_b._data = _FakeData(mgr_b._local_id)
1155
1156
return mgr_a, mgr_b
1157
@@ -1334,7 +1334,7 @@ class TestAcceptNewPeers:
1334
mgr = _make_manager()
1335
peer_id = "10.0.0.1:8000"
1336
existing = _FakeSession(peer_id=peer_id, connected=True)
1337
- mgr._sessions[peer_id] = existing # type: ignore[assignment]
1337
+ mgr._sessions[peer_id] = existing
1338
1339
new_conn = _RecordingConn(peer_id)
1340
mgr._accept_new_peers([new_conn])
@@ -1365,7 +1365,7 @@ class TestAcceptNewPeers:
1365
pass
1366
1367
mgr = _make_manager()
1368
- mgr._data = FakeData() # type: ignore[assignment]
1368
+ mgr._data = FakeData()
1369
peer_id = "10.0.0.1:8000"
1370
1371
# Real ControlConnection-shaped fake: send/close/peer_id only.
@@ -1382,7 +1382,7 @@ class TestAcceptNewPeers:
1382
def close(self) -> None:
1383
self.alive = False
1384
1385
- mgr._accept_new_peers([_Conn(peer_id)]) # type: ignore[arg-type]
1385
+ mgr._accept_new_peers([_Conn(peer_id)])
1386
1387
assert peer_id in mgr._sessions
1388
assert mgr._sessions[peer_id].connected is True
@@ -1411,7 +1411,7 @@ class TestPollOnce:
1411
loads=[LoadResult(job_id=11, kv_request_id="req-11", success=True)],
1412
stores=[StoreResult(job_id=22, success=True)],
1413
)
1414
- mgr._sessions[peer_alive] = alive # type: ignore[assignment]
1414
+ mgr._sessions[peer_alive] = alive
1415
1416
# Dead session whose pending close() jobs surface as failures.
1417
peer_dead = "10.0.0.3:9999"
@@ -1423,7 +1423,7 @@ class TestPollOnce:
1423
close_req_ids=["req-33"],
1424
close_stores=[44],
1425
)
1426
- mgr._sessions[peer_dead] = dead # type: ignore[assignment]
1426
+ mgr._sessions[peer_dead] = dead
1427
1428
class _Ctrl:
1429
def poll(self_inner):
@@ -1433,8 +1433,8 @@ class TestPollOnce:
1433
def remove_remote_peer(self_inner, pid):
1434
pass
1435
1436
- mgr._control = _Ctrl() # type: ignore[assignment]
1437
- mgr._data = _Data() # type: ignore[assignment]
1436
+ mgr._control = _Ctrl()
1437
+ mgr._data = _Data()
1438
1439
mgr._poll_once()
1440
@@ -1464,7 +1464,7 @@ class TestPollOnce:
1464
connected=True,
1465
new_fetch_ids=["req-1"],
1466
)
1467
- mgr._sessions[peer] = sess # type: ignore[assignment]
1467
+ mgr._sessions[peer] = sess
1468
mgr._unbound_stores["req-1"] = [
1469
_UnboundStoreBatch(job_id=5, keys=[b"k1"], block_ids=[0]),
1470
_UnboundStoreBatch(job_id=6, keys=[b"k2"], block_ids=[1]),
@@ -1474,7 +1474,7 @@ class TestPollOnce:
1474
def poll(self_inner):
1475
return []
1476
1477
- mgr._control = _Ctrl() # type: ignore[assignment]
1477
+ mgr._control = _Ctrl()
1478
mgr._poll_once()
1479
1480
assert mgr._kv_to_session["req-1"] is sess
@@ -1496,13 +1496,13 @@ class TestPollOnce:
1496
connected=True,
1497
new_fetch_ids=["req-fast"],
1498
)
1499
- mgr._sessions[peer] = sess # type: ignore[assignment]
1499
+ mgr._sessions[peer] = sess
1500
1501
class _Ctrl:
1502
def poll(self_inner):
1503
return []
1504
1505
- mgr._control = _Ctrl() # type: ignore[assignment]
1505
+ mgr._control = _Ctrl()
1506
mgr._poll_once()
1507
1508
assert mgr._kv_to_session["req-fast"] is sess
@@ -1519,13 +1519,13 @@ class TestPollOnce:
1519
connected=True,
1520
loads=[LoadResult(job_id=5, kv_request_id="req-5", success=False)],
1521
)
1522
- mgr._sessions[peer] = sess # type: ignore[assignment]
1522
+ mgr._sessions[peer] = sess
1523
1524
class _Ctrl:
1525
def poll(self_inner):
1526
return []
1527
1528
- mgr._control = _Ctrl() # type: ignore[assignment]
1528
+ mgr._control = _Ctrl()
1529
1530
mgr._poll_once()
1531
@@ -1549,26 +1549,26 @@ class TestDrainJobs:
1549
def test_returns_immediately_when_quiescent(self):
1550
"""No sessions and no inflight: drain_jobs returns without sleeping."""
1551
mgr = _make_manager()
1552
- mgr._control = _DrainCtrl() # type: ignore[assignment]
1552
+ mgr._control = _DrainCtrl()
1553
1554
sleeps: list[float] = []
1555
# If drain_jobs sleeps when nothing is pending, that's a regression.
1556
import vllm.v1.kv_offload.tiering.p2p.manager as m
1557
1558
original_sleep = m.time.sleep
1559
- m.time.sleep = lambda s: sleeps.append(s) # type: ignore[assignment]
1559
+ m.time.sleep = lambda s: sleeps.append(s)
1560
try:
1561
mgr.drain_jobs()
1562
finally:
1563
- m.time.sleep = original_sleep # type: ignore[assignment]
1563
+ m.time.sleep = original_sleep
1564
1565
assert sleeps == []
1566
1567
def test_returns_when_session_has_no_inflight_or_inbound(self):
1568
"""A session with empty _inbound and _inflight does not block drain."""
1569
mgr = _make_manager()
1570
- mgr._control = _DrainCtrl() # type: ignore[assignment]
1571
- mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") # type: ignore[assignment]
1570
+ mgr._control = _DrainCtrl()
1571
+ mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1")
1572
# Should return on the first iteration.
1573
mgr.drain_jobs()
1574
@@ -1576,10 +1576,10 @@ class TestDrainJobs:
1576
"""A session that stays inflight past 5s triggers the warning, and
1577
once it clears the loop returns."""
1578
mgr = _make_manager()
1579
- mgr._control = _DrainCtrl() # type: ignore[assignment]
1579
+ mgr._control = _DrainCtrl()
1580
sess = _FakeSession(peer_id="peer:1")
1581
sess._server._inflight = {1: object()} # non-empty
1582
- mgr._sessions["peer:1"] = sess # type: ignore[assignment]
1582
+ mgr._sessions["peer:1"] = sess
1583
1584
# Synthetic monotonic clock: 100.0 for the start stamp, then 106.0
1585
# for the first elapsed-check (past the 5s warning threshold), then
tests/v1/kv_offload/tiering/p2p/test_sessions.py
+15
-15
@@ -288,17 +288,17 @@ def _make_session(
288
session = P2PSession(
289
peer_id=peer_id,
290
local_id=local_id,
291
- transport=transport, # type: ignore[arg-type]
291
+ transport=transport,
292
local_block_len=transport.block_len,
293
local_hash_seed=local_hash_seed,
294
- conn=conn, # type: ignore[arg-type]
294
+ conn=conn,
295
)
296
return session, conn, transport
297
298
299
def _serve(session: P2PSession, parent: FakeParent) -> None:
300
"""Resolve enqueued inbound lookups, as the manager does each step."""
301
- session.serve_external_requests(parent) # type: ignore[arg-type]
301
+ session.serve_external_requests(parent)
302
303
304
def _activate(
@@ -1951,7 +1951,7 @@ class TestFinishRequestServerSide:
1951
)
1952
session.poll()
1953
# Force write_blocks to fail on the next call.
1954
- transport.write_blocks = lambda *a, **kw: None # type: ignore[assignment]
1954
+ transport.write_blocks = lambda *a, **kw: None # type: ignore[method-assign]
1955
1956
session.add_stored_blocks("req-1", [b"k1"], [0], job_id=42)
1957
@@ -2057,7 +2057,7 @@ class TestFinishRequestServerSide:
2057
assert outbound.finishing is False
2058
2059
# Round 2: write_blocks fails for k2 while transfer_1 is still inflight.
2060
- transport.write_blocks = lambda *a, **kw: None # type: ignore[assignment]
2060
+ transport.write_blocks = lambda *a, **kw: None # type: ignore[method-assign]
2061
session.add_stored_blocks("req-1", [b"k2"], [1], job_id=200)
2062
# No new transfer was registered.
2063
assert list(session._server._inflight.keys()) == [tid_1]
@@ -2163,7 +2163,7 @@ class TestPendingSession:
2163
session = P2PSession(
2164
peer_id="peer:8000",
2165
local_id="local:9000",
2166
- transport=transport, # type: ignore[arg-type]
2166
+ transport=transport,
2167
local_block_len=4096,
2168
local_hash_seed=_DEFAULT_HASH_SEED,
2169
conn=None,
@@ -2183,13 +2183,13 @@ class TestPendingSession:
2183
session = P2PSession(
2184
peer_id="peer:8000",
2185
local_id="local:9000",
2186
- transport=transport, # type: ignore[arg-type]
2186
+ transport=transport,
2187
local_block_len=4096,
2188
local_hash_seed=_DEFAULT_HASH_SEED,
2189
conn=None,
2190
)
2191
conn = FakeConnection(peer_id="peer:8000")
2192
- session.attach_connection(conn) # type: ignore[arg-type]
2192
+ session.attach_connection(conn)
2193
assert conn._sent
2194
assert conn._sent[0][TYPE_KEY] == ConnectMsg.TYPE
2195
@@ -2197,7 +2197,7 @@ class TestPendingSession:
2197
"""attach_connection on an already-connected session raises."""
2198
session, conn, _ = _make_session()
2199
with pytest.raises(ValueError, match="already connected"):
2200
- session.attach_connection(FakeConnection()) # type: ignore[arg-type]
2200
+ session.attach_connection(FakeConnection())
2201
2202
def test_pending_close_returns_pending_stores(self):
2203
"""Closing a pending session reports buffered stores as failed."""
@@ -2205,7 +2205,7 @@ class TestPendingSession:
2205
session = P2PSession(
2206
peer_id="peer:8000",
2207
local_id="local:9000",
2208
- transport=transport, # type: ignore[arg-type]
2208
+ transport=transport,
2209
local_block_len=4096,
2210
local_hash_seed=_DEFAULT_HASH_SEED,
2211
conn=None,
@@ -2313,7 +2313,7 @@ class TestAdversarial:
2313
def test_non_dict_message(self):
2314
session, conn, _ = _make_session()
2315
_activate(session, conn)
2316
- conn._inbox.append(42) # type: ignore[arg-type]
2316
+ conn._inbox.append(42)
2317
result_ = session.poll()
2318
loads = result_.loads
2319
stores = result_.stores
@@ -2402,7 +2402,7 @@ class TestDispatchErrorHandling:
2402
def _boom(*args, **kwargs):
2403
raise RuntimeError("simulated internal bug")
2404
2405
- session._server.on_fetch = _boom # type: ignore[assignment]
2405
+ session._server.on_fetch = _boom
2406
conn.enqueue(
2407
{
2408
TYPE_KEY: FetchMsg.TYPE,
@@ -2425,7 +2425,7 @@ class TestDispatchErrorHandling:
2425
def _boom(*args, **kwargs):
2426
raise RuntimeError("simulated internal bug")
2427
2428
- session._server.on_fetch = _boom # type: ignore[assignment]
2428
+ session._server.on_fetch = _boom
2429
for _ in range(_MAX_CONSECUTIVE_DISPATCH_ERRORS):
2430
conn.enqueue(
2431
{
@@ -2454,7 +2454,7 @@ class TestDispatchErrorHandling:
2454
# Alternate (boom, success) (_MAX-1) times: counter rises to 1
2455
# then resets to 0 each cycle, never reaching the threshold.
2456
for _ in range(_MAX_CONSECUTIVE_DISPATCH_ERRORS - 1):
2457
- session._server.on_fetch = _boom # type: ignore[assignment]
2457
+ session._server.on_fetch = _boom
2458
conn.enqueue(
2459
{
2460
TYPE_KEY: FetchMsg.TYPE,
@@ -2465,7 +2465,7 @@ class TestDispatchErrorHandling:
2465
}
2466
)
2467
session.poll()
2468
- session._server.on_fetch = original_on_fetch # type: ignore[assignment]
2468
+ session._server.on_fetch = original_on_fetch
2469
# A benign no-op message (unknown type) dispatches cleanly
2470
# and resets the consecutive-error counter.
2471
conn.enqueue({TYPE_KEY: "unknown_for_test"})
tests/v1/sample/test_dry.py
+3
-3
@@ -340,7 +340,7 @@ def _make_v2_state(
340
device=device,
341
all_token_ids=SimpleNamespace(gpu=all_tokens),
342
)
343
- state = DryState(_make_vllm_config(), req_states) # type: ignore[arg-type]
343
+ state = DryState(_make_vllm_config(), req_states)
344
if tokenizer is not None:
345
# Re-resolve the default set now that a tokenizer is installed.
346
state._tokenizer = tokenizer
@@ -446,7 +446,7 @@ def test_spec_decode_is_refused_at_construction():
446
)
447
config = _make_vllm_config(speculative_config=SimpleNamespace())
448
with pytest.raises(ValueError, match="speculative decoding"):
449
- DryState(config, req_states) # type: ignore[arg-type]
449
+ DryState(config, req_states)
450
451
452
def test_v2_draft_expanded_logits_raise():
@@ -918,7 +918,7 @@ def test_loads_through_the_loader_by_fqcn():
918
)
919
procs = loader.build_custom_logits_processors(
920
_make_vllm_config(),
921
- req_states, # type: ignore[arg-type]
921
+ req_states,
922
False,
923
[DRY_FQCN],
924
)
tests/v1/sample/test_logprobs.py
+3
-3
@@ -486,12 +486,12 @@ def test_prompt_logprob_token_ids_require_v2_model_runner():
486
params = SamplingParams(prompt_logprob_token_ids=[1, 2])
487
with patch.object(SamplingParams, "verify"):
488
with pytest.raises(VLLMValidationError, match="V2 model runner"):
489
- InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type]
489
+ InputProcessor._validate_params(processor, params, ("generate",))
490
processor.vllm_config.use_v2_model_runner = True
491
- InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type]
491
+ InputProcessor._validate_params(processor, params, ("generate",))
492
processor.vllm_config.cache_config.kv_sharing_fast_prefill = True
493
with pytest.raises(VLLMValidationError, match="fast-prefill"):
494
- InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type]
494
+ InputProcessor._validate_params(processor, params, ("generate",))
495
496
497
def test_none_logprobs(vllm_model, example_prompts):
tests/v1/sample/test_trace_replay_params.py
+1
-1
@@ -105,7 +105,7 @@ def test_trace_decode_token_ids_rejects_speculative_decoding():
105
with pytest.raises(ValueError, match="not supported with speculative decoding"):
106
params._validate_trace_replay(
107
_make_model_config(vocab_size=100),
108
- speculative_config=object(), # type: ignore[arg-type] # Only non-None presence is tested.
108
+ speculative_config=object(),
109
)
110
111
tests/v1/simple_kv_offload/test_worker.py
+3
-3
@@ -71,7 +71,7 @@ SLEEP_CYCLES = 50_000_000
71
def _make_worker(
72
kv_cache_config: KVCacheConfig | None, cpu_capacity_bytes: int
73
) -> SimpleCPUOffloadWorker:
74
- return SimpleCPUOffloadWorker(None, kv_cache_config, cpu_capacity_bytes) # type: ignore[arg-type]
74
+ return SimpleCPUOffloadWorker(None, kv_cache_config, cpu_capacity_bytes)
75
76
77
def _make_backend() -> tuple[DmaCopyBackend, torch.Tensor, torch.Tensor]:
@@ -121,7 +121,7 @@ def test_no_forward_step_completes_cpu_store(monkeypatch, use_v2):
121
monkeypatch.setattr(f"{module}.get_forward_context", lambda: None)
122
result = active.no_forward(output)
123
else:
124
- result = KVConnectorModelRunnerMixin.kv_connector_no_forward(output, None) # type: ignore[arg-type]
124
+ result = KVConnectorModelRunnerMixin.kv_connector_no_forward(output, None)
125
completion = (
126
result.kv_connector_output.kv_connector_worker_meta
127
if result.kv_connector_output is not None
@@ -283,7 +283,7 @@ def test_transfer_hooks_pass_wait_event_for_store_only():
283
cpu_capacity_bytes=0,
284
)
285
recording = _RecordingBackend()
286
- worker._backend = recording # type: ignore[assignment]
286
+ worker._backend = recording
287
worker._connector_metadata = SimpleCPUOffloadMetadata(
288
load_event=0,
289
load_gpu_blocks=[0],
tests/v1/spec_decode/test_adaptive_verification.py
+4
-6
@@ -27,7 +27,7 @@ def make_manager(
27
manager.num_speculative_steps = num_steps
28
manager._stale_confidences = [SimpleNamespace(np=confidences)] # type: ignore[list-item] # CPU-only confidence buffer.
29
manager._stale_idx = 0
30
- manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture.
30
+ manager.req_states = SimpleNamespace(
31
req_id_to_index={"low": 0, "high": 1},
32
num_computed_tokens_np=np.ones(num_reqs, dtype=np.int32),
33
prefill_len=SimpleNamespace(np=np.ones(num_reqs, dtype=np.int32)),
@@ -153,11 +153,11 @@ def test_manager_checks_target_varlen_cudagraph_bound(
153
manager = maybe_create_adaptive_verification_manager(
154
enable_adaptive_verification=True,
155
attn_groups=groups,
156
- req_states=SimpleNamespace(num_speculative_steps=7), # type: ignore[arg-type]
156
+ req_states=SimpleNamespace(num_speculative_steps=7),
157
query_start_loc=object(),
158
num_bonus_tokens=1,
159
max_total_logits=1,
160
- vllm_config=None, # type: ignore[arg-type]
160
+ vllm_config=None,
161
target_layer_names={"target"},
162
additional_attn_cg_support=additional,
163
)
@@ -186,9 +186,7 @@ def test_budget_stops_where_marginal_drafts_stop_paying_for_themselves():
186
187
def test_profiled_batches_seed_cost_curves_via_consumer(monkeypatch):
188
manager = AdaptiveVerificationManager.__new__(AdaptiveVerificationManager)
189
- manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture.
190
- max_num_batched_tokens=4096, max_num_reqs=64
191
- )
189
+ manager.req_states = SimpleNamespace(max_num_batched_tokens=4096, max_num_reqs=64)
190
manager.num_speculative_steps = 7
191
manager.num_bonus_tokens = 1
192
curves: dict[str, list[tuple[int, float]]] = {}
tests/v1/spec_decode/test_dflash2.py
+8
-8
@@ -98,7 +98,7 @@ def test_draft_quant_exclusions_include_global_layer_indices():
98
]
99
)
100
101
- _add_global_draft_layer_exclusions(quant_config, 88, 5) # type: ignore[arg-type]
101
+ _add_global_draft_layer_exclusions(quant_config, 88, 5)
102
103
assert "layers.88.mlp_conv*" in quant_config.exclude_modules
104
assert "*layers.92.self_attn.q_proj" in quant_config.exclude_modules
@@ -171,7 +171,7 @@ def test_selector_leaves_greedy_drafting_without_proposal_logits(monkeypatch):
171
allocating one here would claim a proposal the walk never sampled from.
172
"""
173
_stub_base(monkeypatch, None)
174
- speculator = DFlash2Speculator(None, torch.device("cpu")) # type: ignore[arg-type] # Base initialization is stubbed.
174
+ speculator = DFlash2Speculator(None, torch.device("cpu"))
175
176
assert speculator.draft_logits is None
177
@@ -183,7 +183,7 @@ def test_selector_asks_for_fp32_proposal_logits():
183
candidate row often enough that the walk and the rejection sampler checking it
184
would no longer read the same distribution.
185
"""
186
- dtype, fill = DFlash2Speculator.draft_logits_spec(None, None) # type: ignore[arg-type] # Constant spec ignores self/config.
186
+ dtype, fill = DFlash2Speculator.draft_logits_spec(None, None)
187
188
assert dtype is torch.float32
189
assert fill == float("-inf")
@@ -309,9 +309,9 @@ def test_candidate_model_decoder_layer_cls(monkeypatch, variant):
309
vllm_config.compilation_config = mock_current_vllm_config.compilation_config
310
311
# 3. Instantiate the model under meta device to avoid parameter allocation issues
312
- with set_current_vllm_config(mock_current_vllm_config), torch.device("meta"): # type: ignore[arg-type]
312
+ with set_current_vllm_config(mock_current_vllm_config), torch.device("meta"):
313
model_cls = DFlash2Qwen3Model if variant == "dflash2" else LiLiCorr
314
- model = model_cls(vllm_config=vllm_config) # type: ignore[arg-type]
314
+ model = model_cls(vllm_config=vllm_config)
315
316
# 4. Assert that the layers are DFlash2Qwen3DecoderLayer (the subclass)
317
assert len(model.layers) == 2
@@ -350,7 +350,7 @@ def test_conv_projections_use_draft_quant_config(monkeypatch):
350
quant_method="W4A16_NVFP4", is_checkpoint_nvfp4_serialized=True
351
)
352
layer = DFlash2Qwen3DecoderLayer(
353
- SimpleNamespace( # type: ignore[arg-type]
353
+ SimpleNamespace(
354
speculative_config=SimpleNamespace(num_speculative_tokens=7),
355
model_config=SimpleNamespace(dtype=torch.bfloat16),
356
),
@@ -434,7 +434,7 @@ def test_context_kv_uses_quantized_projection_fallback(monkeypatch):
434
for projection in projections
435
]
436
qwen3_dflash.DFlashQwen3Model._build_context_kv_buffers(
437
- model, # type: ignore[arg-type]
437
+ model,
438
layers_attn,
439
has_bias=False,
440
)
@@ -442,7 +442,7 @@ def test_context_kv_uses_quantized_projection_fallback(monkeypatch):
442
assert all(not hasattr(projection, "weight") for projection in projections)
443
444
actual_k, actual_v = qwen3_dflash.DFlashQwen3Model._project_context_kv(
445
- model, # type: ignore[arg-type]
445
+ model,
446
context_states,
447
num_ctx=2,
448
num_layers=2,
tests/v1/spec_decode/test_dflash_lookahead.py
+4
-4
@@ -141,9 +141,9 @@ def test_dflash_drafter_window_reserves_bonus_token():
141
speculative_config=_dflash_speculative_config(NUM_SPECULATIVE_TOKENS),
142
)
143
# window = 4, so 96 fits (96 + 4 == 100) but 97 does not (97 + 4 == 101)
144
- assert input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=96)) # type: ignore[arg-type]
145
- assert not input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=97)) # type: ignore[arg-type]
146
- assert not input_fits_in_drafter(dflash_runner, None) # type: ignore[arg-type] # No metadata.
144
+ assert input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=96))
145
+ assert not input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=97))
146
+ assert not input_fits_in_drafter(dflash_runner, None)
147
148
# Other drafters don't reserve the bonus token, so 97 fits (97 + 3 == 100).
149
plain_runner = SimpleNamespace(
@@ -151,4 +151,4 @@ def test_dflash_drafter_window_reserves_bonus_token():
151
effective_drafter_max_model_len=100,
152
speculative_config=SimpleNamespace(use_dflash=lambda: False),
153
)
154
- assert input_fits_in_drafter(plain_runner, SimpleNamespace(max_seq_len=97)) # type: ignore[arg-type]
154
+ assert input_fits_in_drafter(plain_runner, SimpleNamespace(max_seq_len=97))
tests/v1/spec_decode/test_dsv4_mtp_local_argmax.py
+1
-3
@@ -158,9 +158,7 @@ def test_wrapper_forwards_spec_step_idx():
158
159
hidden_states = torch.empty(0)
160
wrapper = object.__new__(DeepSeekV4MTP)
161
- wrapper.model = SimpleNamespace( # type: ignore[assignment]
162
- get_top_tokens=lambda *args: args
163
- )
161
+ wrapper.model = SimpleNamespace(get_top_tokens=lambda *args: args)
162
163
assert DeepSeekV4MTP.get_top_tokens(wrapper, hidden_states, 2) == (hidden_states, 2)
164
assert DeepSeekV4MTP.get_top_tokens(wrapper, hidden_states) == (hidden_states, 0)
tests/v1/spec_decode/test_extract_hidden_states.py
+4
-4
@@ -51,7 +51,7 @@ def _create_proposer(
51
target_parallel_config=ParallelConfig(),
52
method="extract_hidden_states",
53
num_speculative_tokens=num_speculative_tokens,
54
- draft_model_config={ # type: ignore[arg-type]
54
+ draft_model_config={
55
"hf_config": {
56
"eagle_aux_hidden_state_layer_ids": layer_ids,
57
}
@@ -103,7 +103,7 @@ def test_proposer_initialization_missing_layer_ids():
103
target_parallel_config=ParallelConfig(),
104
method="extract_hidden_states",
105
num_speculative_tokens=1,
106
- draft_model_config={ # type: ignore[arg-type]
106
+ draft_model_config={
107
"hf_config": {} # Missing eagle_aux_hidden_state_layer_ids
108
},
109
)
@@ -363,7 +363,7 @@ def test_extract_hidden_states_text_only_config_regression():
363
target_parallel_config=ParallelConfig(),
364
method="extract_hidden_states",
365
num_speculative_tokens=1,
366
- draft_model_config={ # type: ignore[arg-type]
366
+ draft_model_config={
367
"hf_config": {
368
"eagle_aux_hidden_state_layer_ids": [1, 2, 3, 4],
369
}
@@ -450,7 +450,7 @@ def test_extract_hidden_states_speculative_config_vlm():
450
target_parallel_config=ParallelConfig(),
451
method="extract_hidden_states",
452
num_speculative_tokens=1,
453
- draft_model_config={ # type: ignore[arg-type]
453
+ draft_model_config={
454
"hf_config": {
455
"eagle_aux_hidden_state_layer_ids": [1, 2],
456
}
tests/v1/spec_decode/test_lilicorr.py
+11
-11
@@ -190,17 +190,17 @@ def test_runtime_length_keeps_trained_checkpoint_geometry(monkeypatch):
190
for slots in (1, 3):
191
spec.num_speculative_tokens = slots
192
head = LiLiCorr(
193
- vllm_config=SimpleNamespace(speculative_config=spec) # type: ignore[arg-type]
193
+ vllm_config=SimpleNamespace(speculative_config=spec)
194
).lilicorr
195
assert head.slot_embedding.shape == (1, 1, 3, 1, 8)
196
assert head.relative_slot_bias.shape == (2, 7)
197
spec.draft_model_config.hf_config.dflash_config["lilicorr_enabled"] = False
198
with pytest.raises(ValueError, match="lilicorr_enabled"):
199
- LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) # type: ignore[arg-type]
199
+ LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec))
200
spec.draft_model_config.hf_config.dflash_config["lilicorr_enabled"] = True
201
spec.num_speculative_tokens = 4
202
with pytest.raises(ValueError, match="trained block_size"):
203
- LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) # type: ignore[arg-type]
203
+ LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec))
204
205
206
@pytest.mark.parametrize("tp_size", [1, 2])
@@ -269,8 +269,8 @@ def test_candidates_use_global_partition_and_exclude_padding(monkeypatch, tp_siz
269
)
270
monkeypatch.setattr(logits_processor, "_topk", lambda x, k: x.topk(k, dim=-1))
271
ids, values = logits_processor.LogitsProcessor.get_top_k_tokens(
272
- fake, # type: ignore[arg-type]
273
- lm_head, # type: ignore[arg-type]
272
+ fake,
273
+ lm_head,
274
torch.empty(2, 1),
275
2,
276
return_log_probs=True,
@@ -291,13 +291,13 @@ def test_context_anchor_is_last_committed_normalized_feature():
291
anchor_valid=torch.ones(4, dtype=torch.bool),
292
)
293
batch = SimpleNamespace(num_reqs=2, query_start_loc=torch.tensor([0, 2, 6]))
294
- LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([0, 2])) # type: ignore[arg-type]
294
+ LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([0, 2]))
295
torch.testing.assert_close(spec.anchor_hidden[:2], norm(hidden[[1, 3]]))
296
assert spec.anchor_valid.tolist() == [True, True, False, False]
297
assert not spec.anchor_hidden[2:].any()
298
# A smaller reordered batch must not retain an old request's anchor.
299
batch = SimpleNamespace(num_reqs=1, query_start_loc=torch.tensor([0, 3]))
300
- LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([1])) # type: ignore[arg-type]
300
+ LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([1]))
301
torch.testing.assert_close(spec.anchor_hidden[0], norm(hidden[1]))
302
assert not spec.anchor_hidden[1:].any()
303
@@ -321,7 +321,7 @@ def test_candidate_generation_routes_scores_and_adaptive_inputs(monkeypatch, lil
321
322
monkeypatch.setattr(DFlashSpeculator, "__init__", init_base)
323
cls = LiLiCorrSpeculator if lilicorr else DFlash2Speculator
324
- spec = cls(None, torch.device("cpu")) # type: ignore[arg-type]
324
+ spec = cls(None, torch.device("cpu"))
325
hidden = torch.arange(36).float().view(9, 4)
326
spec._run_model = lambda *args: hidden
327
spec.sample_indices = torch.tensor([1, 2, 4, 5, 7, 8])
@@ -334,7 +334,7 @@ def test_candidate_generation_routes_scores_and_adaptive_inputs(monkeypatch, lil
334
spec.draft_logits = None
335
spec.use_fp64_gumbel = False
336
spec.enable_adaptive_verification = True
337
- spec.input_buffers = SimpleNamespace(input_ids=torch.arange(9)) # type: ignore[assignment]
337
+ spec.input_buffers = SimpleNamespace(input_ids=torch.arange(9))
338
candidates = torch.arange(24).view(6, 4)
339
log_probs = candidates.float().log_softmax(-1)
340
scores = torch.randn(3, 2, 4, 4)
@@ -636,7 +636,7 @@ def owned_head_model(monkeypatch):
636
compilation_config=CompilationConfig(mode=CompilationMode.NONE),
637
)
638
):
639
- model = LiLiCorrForCausalLM(vllm_config=vllm_config) # type: ignore[arg-type]
639
+ model = LiLiCorrForCausalLM(vllm_config=vllm_config)
640
return model, vllm_config
641
642
return build
@@ -746,7 +746,7 @@ def test_quantized_head_calls_methods_without_reading_packed_weights(monkeypatch
746
block_size=4,
747
rms_norm_eps=1e-6,
748
config=_config(hidden_size=8),
749
- quant_config=quant_config, # type: ignore[arg-type]
749
+ quant_config=quant_config,
750
prefix="model.lilicorr",
751
)
752
with torch.no_grad():
tests/v1/spec_decode/test_llm_base_proposer.py
+1
-1
@@ -53,7 +53,7 @@ def _make_proposer(
53
monkeypatch.setattr(llm_base_proposer, "AttentionGroup", _FakeAttentionGroup)
54
55
proposer = EagleProposer.__new__(EagleProposer)
56
- proposer.vllm_config = None # type: ignore[assignment] # Patched backend discovery does not read config.
56
+ proposer.vllm_config = None
57
proposer.device = None
58
proposer._draft_attn_layer_names = set(layer_names)
59
proposer.kv_cache_gid = -1
tests/v1/spec_decode/test_llm_base_proposer_sampling.py
+1
-1
@@ -85,7 +85,7 @@ def test_compute_probs_and_sample_next_token_uses_fp64_exponential_race():
85
def test_mtp_model_returns_tuple(architecture: str, expected: bool):
86
proposer = object.__new__(SpecDecodeBaseProposer)
87
proposer.method = "mtp"
88
- proposer.draft_model_config = SimpleNamespace( # type: ignore[assignment] # Architecture-only config.
88
+ proposer.draft_model_config = SimpleNamespace(
89
hf_config=SimpleNamespace(architectures=[architecture])
90
)
91
tests/v1/spec_decode/test_rejection_sampler_utils.py
+1
-1
@@ -700,7 +700,7 @@ def test_verify_rejects_unproposed_drafts():
700
first_pos = inputs["pos"].view(num_trials, K + 1)[:, 0]
701
prefill_len = first_pos + 1
702
rejection_sampler = object.__new__(RejectionSampler)
703
- rejection_sampler.sampler = SimpleNamespace( # type: ignore[assignment]
703
+ rejection_sampler.sampler = SimpleNamespace(
704
apply_sampling_params=lambda logits, *args: logits,
705
sampling_states=SimpleNamespace(
706
temperature=SimpleNamespace(gpu=inputs["temperature"]),
tests/v1/structured_output/test_backend_xgrammar_lark.py
+2
-2
@@ -48,9 +48,9 @@ def _validate(
48
) -> StructuredOutputsParams:
49
params = SamplingParams(structured_outputs=StructuredOutputsParams(grammar=grammar))
50
params._validate_structured_outputs(
51
- _StubModelConfig(), # type: ignore[arg-type]
51
+ _StubModelConfig(),
52
StructuredOutputsConfig(backend=backend),
53
- tokenizer=tokenizer or object(), # type: ignore[arg-type]
53
+ tokenizer=tokenizer or object(),
54
)
55
assert params.structured_outputs is not None
56
return params.structured_outputs
tests/v1/structured_output/test_backend_xgrammar_plamo3.py
+3
-3
@@ -51,7 +51,7 @@ def make_vllm_config() -> VllmConfig:
51
config = VllmConfig(
52
structured_outputs_config=StructuredOutputsConfig(backend="xgrammar"),
53
)
54
- config.model_config = SimpleNamespace( # type: ignore[assignment]
54
+ config.model_config = SimpleNamespace(
55
hf_config=SimpleNamespace(model_type="plamo3")
56
)
57
return config
@@ -73,7 +73,7 @@ def test_plamo3_python_tokenizer_compiles_and_accepts_structural_tag():
73
tokenizer = Plamo3Tokenizer(["<eos>", *call_tokens])
74
backend = XgrammarBackend(
75
make_vllm_config(),
76
- tokenizer=tokenizer, # type: ignore[arg-type]
76
+ tokenizer=tokenizer,
77
vocab_size=len(tokenizer.get_vocab()),
78
)
79
tools = [
@@ -107,7 +107,7 @@ def test_plamo3_grammar_matches_decoded_bytes(value):
107
tokenizer = Plamo3Tokenizer(list(dict.fromkeys(["<eos>", value, *pieces])))
108
backend = XgrammarBackend(
109
make_vllm_config(),
110
- tokenizer=tokenizer, # type: ignore[arg-type]
110
+ tokenizer=tokenizer,
111
vocab_size=len(tokenizer.get_vocab()),
112
)
113
for tokens in ([value], pieces):
tests/v1/structured_output/test_structured_output_manager.py
+1
-1
@@ -108,7 +108,7 @@ def _build_harness(
108
)
109
manager = StructuredOutputManager(vllm_config)
110
if use_reasoner:
111
- manager.reasoner_cls = MockReasoner # type: ignore[assignment]
111
+ manager.reasoner_cls = MockReasoner
112
113
sampling_params = SamplingParams(
114
structured_outputs=structured_outputs
tests/v1/structured_output/test_validation.py
+10
-10
@@ -35,7 +35,7 @@ def test_structured_outputs_rejected_for_diffusion_models():
35
)
36
with pytest.raises(VLLMValidationError, match="not yet supported for diffusion"):
37
params._validate_structured_outputs(
38
- _StubModelConfig(is_diffusion=True), # type: ignore[arg-type]
38
+ _StubModelConfig(is_diffusion=True),
39
StructuredOutputsConfig(),
40
tokenizer=None,
41
)
@@ -45,7 +45,7 @@ def test_plain_request_allowed_for_diffusion_models():
45
"""Requests without structured outputs are unaffected by the guard."""
46
params = SamplingParams()
47
params._validate_structured_outputs(
48
- _StubModelConfig(is_diffusion=True), # type: ignore[arg-type]
48
+ _StubModelConfig(is_diffusion=True),
49
StructuredOutputsConfig(),
50
tokenizer=None,
51
)
@@ -71,9 +71,9 @@ def test_degenerate_structured_outputs_rejected(structured_outputs, match):
71
params = SamplingParams(structured_outputs=structured_outputs)
72
with pytest.raises(VLLMValidationError, match=match):
73
params._validate_structured_outputs(
74
- _StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
74
+ _StubModelConfig(is_diffusion=False),
75
StructuredOutputsConfig(),
76
- tokenizer=object(), # type: ignore[arg-type]
76
+ tokenizer=object(),
77
)
78
79
@@ -97,9 +97,9 @@ def test_regex_with_nul_byte_rejected(regex):
97
# (which would otherwise catch the error and fall back to another backend).
98
with pytest.raises(VLLMValidationError, match="NUL"):
99
params._validate_structured_outputs(
100
- _StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
100
+ _StubModelConfig(is_diffusion=False),
101
StructuredOutputsConfig(),
102
- tokenizer=object(), # type: ignore[arg-type]
102
+ tokenizer=object(),
103
)
104
105
# The xgrammar backend also rejects it directly (defense in depth), before
@@ -133,9 +133,9 @@ def test_unsupported_grammar_is_a_client_error(backend, structured_outputs):
133
params = SamplingParams(structured_outputs=structured_outputs)
134
with pytest.raises(VLLMClientError):
135
params._validate_structured_outputs(
136
- _StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
136
+ _StubModelConfig(is_diffusion=False),
137
StructuredOutputsConfig(backend=backend),
138
- tokenizer=object(), # type: ignore[arg-type]
138
+ tokenizer=object(),
139
)
140
141
@@ -180,9 +180,9 @@ def test_auto_backend_falls_back_on_unsupported_schema(schema, expected_backend)
180
"""`auto` falls back on rejection, so it must catch what the validators raise."""
181
params = SamplingParams(structured_outputs=StructuredOutputsParams(json=schema))
182
params._validate_structured_outputs(
183
- _StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
183
+ _StubModelConfig(is_diffusion=False),
184
StructuredOutputsConfig(backend="auto"),
185
- tokenizer=object(), # type: ignore[arg-type]
185
+ tokenizer=object(),
186
)
187
assert params.structured_outputs is not None
188
assert params.structured_outputs._backend == expected_backend
tests/v1/worker/test_attn_utils.py
+5
-5
@@ -135,7 +135,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support():
135
_TargetBackend,
136
["target"],
137
spec,
138
- 0, # type: ignore[arg-type]
138
+ 0,
139
)
140
target_group.metadata_builders = [
141
_FakeMetadataBuilder(AttentionCGSupport.ALWAYS) # type: ignore[list-item]
@@ -144,7 +144,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support():
144
_DraftBackend,
145
["draft"],
146
spec,
147
- 0, # type: ignore[arg-type]
147
+ 0,
148
)
149
draft_group.metadata_builders = [
150
_FakeMetadataBuilder(AttentionCGSupport.UNIFORM_BATCH) # type: ignore[list-item]
@@ -152,14 +152,14 @@ def test_attention_checks_preserve_global_and_target_scoped_support():
152
groups = [[target_group, draft_group]]
153
154
# The runner-wide execution mode must still honor the drafter's limit.
155
- unfiltered = get_attn_cg_support(groups, None) # type: ignore[arg-type]
155
+ unfiltered = get_attn_cg_support(groups, None)
156
assert unfiltered.min_cg_support == AttentionCGSupport.UNIFORM_BATCH
157
assert unfiltered.min_cg_attn_backend == "_DraftBackend"
158
159
# Adaptive verification validates only the target's varlen graphs.
160
target_only = get_attn_cg_support(
161
groups,
162
- None, # type: ignore[arg-type]
162
+ None,
163
checked_layer_names={"target"},
164
)
165
assert target_only.min_cg_support == AttentionCGSupport.ALWAYS
@@ -176,7 +176,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support():
176
draft_group.layer_names.append("target")
177
target_with_shared_group = get_attn_cg_support(
178
groups,
179
- None, # type: ignore[arg-type]
179
+ None,
180
checked_layer_names={"target"},
181
)
182
assert target_with_shared_group.min_cg_support == AttentionCGSupport.UNIFORM_BATCH
tests/v1/worker/test_gpu_kv_connector.py
+4
-6
@@ -39,9 +39,7 @@ def _make_connector(
39
kv_role="kv_consumer",
40
kv_buffer_device="cpu",
41
)
42
- connector = ActiveKVConnector( # type: ignore[arg-type]
43
- SimpleNamespace(kv_transfer_config=kv_config), {}
44
- )
42
+ connector = ActiveKVConnector(SimpleNamespace(kv_transfer_config=kv_config), {})
43
events.clear()
44
return connector
45
@@ -66,7 +64,7 @@ def test_load_start_phase(
64
request_indices = torch.tensor([3, 1])
65
request_ids = ["first", "second"]
66
attn_metadata = {"layer": object()}
69
- connector.pre_forward( # type: ignore[arg-type]
67
+ connector.pre_forward(
68
output,
69
request_state_indices=request_indices,
70
request_ids=request_ids,
@@ -85,7 +83,7 @@ def test_load_start_phase(
83
assert kwargs["attn_metadata"] is attn_metadata
84
85
# A subsequent step without a forward must not reuse the prior batch.
88
- connector.no_forward(_scheduler_output(False)) # type: ignore[arg-type]
86
+ connector.no_forward(_scheduler_output(False))
87
assert connector.kv_connector.start_load_kv.call_count == 2
88
assert connector.kv_connector.start_load_kv.call_args.kwargs == {}
89
@@ -94,6 +92,6 @@ def test_no_forward_starts_deferred_load_once(monkeypatch: pytest.MonkeyPatch):
92
events: list[str] = []
93
connector = _make_connector(monkeypatch, events)
94
97
- connector.no_forward(_scheduler_output(False)) # type: ignore[arg-type]
95
+ connector.no_forward(_scheduler_output(False))
96
97
assert events == ["handle", "bind", "start", "wait", "clear"]
tests/v1/worker/test_gpu_worker_weight_transfer.py
+1
-1
@@ -75,7 +75,7 @@ def _make_worker(engine: _RecordingEngine | None) -> Worker:
75
def test_reload_weights_sets_current_config():
76
worker = _make_worker(None)
77
model_runner = _RecordingModelRunner()
78
- worker.model_runner = model_runner # type: ignore[assignment]
78
+ worker.model_runner = model_runner
79
80
Worker.reload_weights(worker)
81
tests/v1/worker/test_late_interaction_runner.py
+1
-1
@@ -142,7 +142,7 @@ def test_invalid_query_uses_raises():
142
mode=LATE_INTERACTION_MODE_CACHE_QUERY,
143
query_key="query-bad",
144
)
145
- bad_meta.query_uses = "bad-int" # type: ignore[assignment]
145
+ bad_meta.query_uses = "bad-int"
146
bad_query_params = _make_pooling_params(bad_meta)
147
148
with pytest.raises(ValueError, match="must be an integer value"):