From fc2c801ad93bcd8d7cd863645ee3ac8533cc85be Mon Sep 17 00:00:00 2001 From: Harry Mellor <19981378+hmellor@users.noreply.github.com> Date: Wed, 30 Sep 2026 16:18:50 +0100 Subject: [PATCH] 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 --- pyproject.toml | 5 + tests/benchmarks/test_bfcl_dataset.py | 4 +- ...est_custom_dataset_chat_template_kwargs.py | 4 +- .../passes/distributed/test_async_tp.py | 2 +- .../distributed/test_fusion_all_reduce.py | 4 +- .../distributed/test_sequence_parallelism.py | 2 +- tests/compile/passes/test_pass_manager.py | 2 +- .../passes/test_silu_mul_quant_fusion.py | 2 +- tests/config/test_config_generation.py | 4 +- tests/config/test_multimodal_config.py | 10 +- tests/conftest.py | 2 +- .../test_anthropic_messages_conversion.py | 2 +- .../cohere/test_cohere_chat_message.py | 4 +- tests/entrypoints/cohere/test_protocol.py | 4 +- .../test_api_server_process_manager.py | 6 +- .../llm/test_mm_processor_kwargs.py | 2 +- .../entrypoints/openai/test_render_parity.py | 2 +- .../pooling/embed/test_io_processor.py | 2 +- .../pooling/scoring/test_io_processor_unit.py | 4 +- .../test_jina_ranking_io_processor_unit.py | 6 +- .../entrypoints/pooling/test_io_processor.py | 4 +- .../test_authentication_middleware.py | 2 +- .../serve/tokenize/test_tokenization.py | 4 +- .../test_qwen3_asr_sanitize_prompt.py | 2 +- .../entrypoints/unit_tests/test_chat_utils.py | 4 +- tests/jit_monitor/test_hooks.py | 2 +- .../attention/test_attention_selector.py | 8 +- tests/kernels/attention/test_cpu_attn.py | 2 +- tests/kernels/attention/test_minimax_m3.py | 2 +- ...st_minimax_m3_msa_cutlass_sparse_decode.py | 10 +- .../test_rocm_aiter_mla_causal_verify_mask.py | 2 +- .../test_rocm_aiter_mla_fp8_prefill.py | 4 +- .../attention/test_rocm_aiter_mla_sink.py | 12 +-- ...est_rocm_aiter_mla_sparse_metadata_sync.py | 4 +- .../test_rocm_paged_mxfp4_indexer.py | 6 +- .../attention/test_rocm_triton_attn_dsv4.py | 4 +- .../mamba/test_gdn_forward_core_split.py | 2 +- tests/kernels/moe/test_cutlass_moe.py | 2 +- tests/kernels/moe/test_ocp_mx_moe.py | 2 +- tests/kernels/quantization/test_block_fp8.py | 2 +- .../kernels/quantization/test_cutlass_w4a8.py | 2 +- .../quantization/test_marlin_tile_padding.py | 6 +- .../quantization/test_nvfp4_emulation.py | 2 +- .../layers/test_fused_shared_expert.py | 6 +- .../layers/test_mla_short_prefill_indexer.py | 8 +- .../layers/test_pooler_activations.py | 4 +- .../layers/test_pooler_methods.py | 2 +- .../tensorizer_loader/test_tensorizer.py | 2 +- .../model_loader/test_weight_cache.py | 2 +- .../language/generation/test_mistral.py | 6 +- .../generation/vlm_utils/model_utils.py | 2 +- tests/models/multimodal/pooling/test_clip.py | 2 +- .../pooling/test_llama_nemotron_vl.py | 2 +- .../models/multimodal/pooling/test_siglip.py | 2 +- .../multimodal/processing/test_qwen2_vl.py | 4 +- tests/models/transformers/test_backend.py | 4 +- tests/multimodal/media/test_video.py | 2 +- tests/multimodal/test_audio.py | 2 +- tests/multimodal/test_cache.py | 24 ++--- tests/multimodal/test_processing.py | 8 +- tests/multimodal/test_registry.py | 2 +- tests/multimodal/test_video.py | 2 +- tests/parser/cohere/test_structural_tags.py | 2 +- .../bitsandbytes/test_bitsandbytes.py | 2 +- .../bitsandbytes/test_transformers.py | 4 +- .../gguf/test_gguf_plugin_multimodal.py | 2 +- tests/plugins_tests/test_endpoint_plugins.py | 4 +- .../test_oot_registration_offline.py | 2 +- .../test_stats_logger_plugins.py | 2 +- tests/quantization/test_auto_gptq.py | 4 +- tests/quantization/test_auto_round.py | 12 +-- tests/quantization/test_fp8.py | 4 +- tests/quantization/test_moe_wna16.py | 8 +- tests/quantization/test_online.py | 8 +- tests/quantization/test_quark.py | 4 +- .../test_trtllm_nvfp4_hidden_dim_padding.py | 2 +- tests/quantization/test_turboquant.py | 2 +- .../test_base_thinking_reasoning_parser.py | 2 +- tests/renderers/test_cohere.py | 100 +++++++++--------- tests/renderers/test_completions.py | 2 +- tests/samplers/test_beam_search.py | 6 +- tests/samplers/test_beam_search_online.py | 4 +- tests/standalone_tests/lazy_imports.py | 2 +- tests/test_audio_media_size_precheck.py | 2 +- tests/tokenizers_/test_mistral.py | 10 +- tests/tokenizers_/test_registry.py | 2 +- .../test_ernie45_moe_tool_parser.py | 4 +- tests/tool_parsers/test_jamba_tool_parser.py | 6 +- .../test_qwen3coder_tool_parser.py | 2 +- .../tool_parsers/test_step3p5_tool_parser.py | 2 +- tests/tool_parsers/test_xlam_tool_parser.py | 8 +- .../test_gemma4_responses_adjust_request.py | 2 +- tests/tool_use/test_kimi_k3_tool_parser.py | 2 +- .../processors/test_voxtral.py | 2 +- tests/transformers_utils/test_processor.py | 4 +- tests/utils.py | 2 +- tests/utils_/test_argparse_utils.py | 18 ++-- .../v1/attention/test_mla_prefill_selector.py | 4 +- .../v1/attention/test_sparse_mla_backends.py | 6 +- tests/v1/cudagraph/test_cudagraph_manager.py | 4 +- tests/v1/cudagraph/test_encoder_cudagraph.py | 8 +- tests/v1/distributed/test_eagle_dp.py | 2 +- .../v1/engine/test_startup_watch_processes.py | 4 +- tests/v1/executor/test_executor.py | 4 +- .../unit/offloading_connector/test_metrics.py | 18 ++-- .../unit/test_mooncake_store_worker.py | 2 +- .../kv_connector/unit/test_nixl_connector.py | 2 +- .../unit/test_nixl_push_connector.py | 2 +- .../v1/kv_offload/tiering/p2p/test_manager.py | 82 +++++++------- .../kv_offload/tiering/p2p/test_sessions.py | 30 +++--- tests/v1/sample/test_dry.py | 6 +- tests/v1/sample/test_logprobs.py | 6 +- tests/v1/sample/test_trace_replay_params.py | 2 +- tests/v1/simple_kv_offload/test_worker.py | 6 +- .../spec_decode/test_adaptive_verification.py | 10 +- tests/v1/spec_decode/test_dflash2.py | 16 +-- tests/v1/spec_decode/test_dflash_lookahead.py | 8 +- .../spec_decode/test_dsv4_mtp_local_argmax.py | 4 +- .../spec_decode/test_extract_hidden_states.py | 8 +- tests/v1/spec_decode/test_lilicorr.py | 22 ++-- .../v1/spec_decode/test_llm_base_proposer.py | 2 +- .../test_llm_base_proposer_sampling.py | 2 +- .../test_rejection_sampler_utils.py | 2 +- .../test_backend_xgrammar_lark.py | 4 +- .../test_backend_xgrammar_plamo3.py | 6 +- .../test_structured_output_manager.py | 2 +- tests/v1/structured_output/test_validation.py | 20 ++-- tests/v1/worker/test_attn_utils.py | 10 +- tests/v1/worker/test_gpu_kv_connector.py | 10 +- .../worker/test_gpu_worker_weight_transfer.py | 2 +- .../v1/worker/test_late_interaction_runner.py | 2 +- 131 files changed, 402 insertions(+), 409 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2098e097bf..b2658168d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,6 +117,11 @@ ignore_missing_imports = true check_untyped_defs = true follow_imports = "silent" +[[tool.mypy.overrides]] +module = "tests.*" +disable_error_code = ["arg-type", "assignment"] +enable_error_code = ["method-assign"] + [tool.pytest.ini_options] markers = [ "slow_test", diff --git a/tests/benchmarks/test_bfcl_dataset.py b/tests/benchmarks/test_bfcl_dataset.py index 222a57a33f..d191922319 100644 --- a/tests/benchmarks/test_bfcl_dataset.py +++ b/tests/benchmarks/test_bfcl_dataset.py @@ -271,7 +271,7 @@ def test_bfcl_prompt_len_includes_tools(tmp_path: Path) -> None: args.num_prompts = 1 with _patch_hf_api(fake_download): - samples = get_samples(args, fake) # type: ignore[arg-type] + samples = get_samples(args, fake) assert len(samples) == 1 assert captured["tools"] is not None, ( @@ -311,7 +311,7 @@ def test_bfcl_prompt_len_falls_back_when_tokenizer_rejects_tools( args.num_prompts = 1 with _patch_hf_api(fake_download): - samples = get_samples(args, _LegacyTokenizer()) # type: ignore[arg-type] + samples = get_samples(args, _LegacyTokenizer()) assert len(samples) == 1 assert samples[0].prompt_len > 0 diff --git a/tests/benchmarks/test_custom_dataset_chat_template_kwargs.py b/tests/benchmarks/test_custom_dataset_chat_template_kwargs.py index 3817fbbb86..149ea6625a 100644 --- a/tests/benchmarks/test_custom_dataset_chat_template_kwargs.py +++ b/tests/benchmarks/test_custom_dataset_chat_template_kwargs.py @@ -58,7 +58,7 @@ def test_chat_template_kwargs_forwarded(tmp_path: Path) -> None: _write_one(jsonl) tok = _RecordingTokenizer() - get_samples(_args(str(jsonl), {"thinking": True}), tok) # type: ignore[arg-type] + get_samples(_args(str(jsonl), {"thinking": True}), tok) assert tok.captured_kwargs == {"thinking": True} @@ -70,6 +70,6 @@ def test_chat_template_kwargs_default_is_noop(tmp_path: Path) -> None: _write_one(jsonl) tok = _RecordingTokenizer() - get_samples(_args(str(jsonl), None), tok) # type: ignore[arg-type] + get_samples(_args(str(jsonl), None), tok) assert tok.captured_kwargs == {} diff --git a/tests/compile/passes/distributed/test_async_tp.py b/tests/compile/passes/distributed/test_async_tp.py index 6601f7a2f0..c0fd4c00a8 100644 --- a/tests/compile/passes/distributed/test_async_tp.py +++ b/tests/compile/passes/distributed/test_async_tp.py @@ -285,7 +285,7 @@ def test_async_tp_pass_requires_full_graph_compilation(): ] async_tp_pass = object.__new__(AsyncTPPass) - async_tp_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment] + async_tp_pass.compilation_config = vllm_config.compilation_config with pytest.raises( AssertionError, match="AsyncTPPass requires full-graph compilation" diff --git a/tests/compile/passes/distributed/test_fusion_all_reduce.py b/tests/compile/passes/distributed/test_fusion_all_reduce.py index a7b4cf0ed0..1c99cc2533 100644 --- a/tests/compile/passes/distributed/test_fusion_all_reduce.py +++ b/tests/compile/passes/distributed/test_fusion_all_reduce.py @@ -111,7 +111,7 @@ def test_fused_ar_workspace_hidden_dim( target_hidden: int, draft_hidden: int | None, expected: int ): config = _make_workspace_hidden_config(target_hidden, draft_hidden) - assert _fused_ar_workspace_hidden_dim(config) == expected # type: ignore[arg-type] + assert _fused_ar_workspace_hidden_dim(config) == expected def test_fused_ar_workspace_hidden_dim_spec_without_draft(): @@ -120,7 +120,7 @@ def test_fused_ar_workspace_hidden_dim_spec_without_draft(): model_config=SimpleNamespace(get_hidden_size=lambda: 2048), speculative_config=SimpleNamespace(draft_model_config=None), ) - assert _fused_ar_workspace_hidden_dim(config) == 2048 # type: ignore[arg-type] + assert _fused_ar_workspace_hidden_dim(config) == 2048 class TestAllReduceRMSNormModel(torch.nn.Module): diff --git a/tests/compile/passes/distributed/test_sequence_parallelism.py b/tests/compile/passes/distributed/test_sequence_parallelism.py index b5c390e24c..c40d75f675 100644 --- a/tests/compile/passes/distributed/test_sequence_parallelism.py +++ b/tests/compile/passes/distributed/test_sequence_parallelism.py @@ -222,7 +222,7 @@ def test_sequence_parallelism_pass_requires_full_graph_compilation(): ] sequence_parallelism_pass = object.__new__(SequenceParallelismPass) - sequence_parallelism_pass.compilation_config = vllm_config.compilation_config # type: ignore[assignment] + sequence_parallelism_pass.compilation_config = vllm_config.compilation_config sequence_parallelism_pass.min_token_num = 1 with pytest.raises( diff --git a/tests/compile/passes/test_pass_manager.py b/tests/compile/passes/test_pass_manager.py index 9ba9892289..459921bae8 100644 --- a/tests/compile/passes/test_pass_manager.py +++ b/tests/compile/passes/test_pass_manager.py @@ -28,7 +28,7 @@ def test_bad_callable(): pass_manager.configure(config) with pytest.raises(AssertionError): - pass_manager.add(simple_callable) # type: ignore[arg-type] + pass_manager.add(simple_callable) # Pass that inherits from InductorPass diff --git a/tests/compile/passes/test_silu_mul_quant_fusion.py b/tests/compile/passes/test_silu_mul_quant_fusion.py index a397dd9406..fa25bd0f20 100644 --- a/tests/compile/passes/test_silu_mul_quant_fusion.py +++ b/tests/compile/passes/test_silu_mul_quant_fusion.py @@ -331,7 +331,7 @@ def test_fusion_silu_and_mul_quant( backend = TestBackend(*passes) model = model_class( hidden_size=hidden_size, - force_kernel=force_kernel, # type: ignore[arg-type] + force_kernel=force_kernel, x=x, dtype=dtype, ) diff --git a/tests/config/test_config_generation.py b/tests/config/test_config_generation.py index a6908f35e5..eea9e8fa4a 100644 --- a/tests/config/test_config_generation.py +++ b/tests/config/test_config_generation.py @@ -133,7 +133,7 @@ def test_get_diff_sampling_param_includes_penalties(): }, ) - diff = ModelConfig.get_diff_sampling_param(fake) # type: ignore[arg-type] + diff = ModelConfig.get_diff_sampling_param(fake) assert diff["presence_penalty"] == 1.5 assert diff["frequency_penalty"] == 0.5 @@ -161,7 +161,7 @@ def test_generation_config_penalties_survive_diff_sampling_filter(): }, ) - diff = ModelConfig.get_diff_sampling_param(fake) # type: ignore[arg-type] + diff = ModelConfig.get_diff_sampling_param(fake) assert diff["presence_penalty"] == 1.1 assert diff["frequency_penalty"] == 0.7 diff --git a/tests/config/test_multimodal_config.py b/tests/config/test_multimodal_config.py index 6c8bead2d5..c1d4cf6454 100644 --- a/tests/config/test_multimodal_config.py +++ b/tests/config/test_multimodal_config.py @@ -40,18 +40,18 @@ def test_supports_multimodal_inputs(model_id, limit_mm_per_prompt, expected): def test_mm_encoder_attn_backend_str_conversion(): - config = MultiModalConfig(mm_encoder_attn_backend="FLASH_ATTN") # type: ignore[arg-type] + config = MultiModalConfig(mm_encoder_attn_backend="FLASH_ATTN") assert config.mm_encoder_attn_backend == AttentionBackendEnum.FLASH_ATTN def test_mm_encoder_attn_backend_invalid(): with pytest.raises(ValueError): - MultiModalConfig(mm_encoder_attn_backend="not_a_backend") # type: ignore[arg-type] + MultiModalConfig(mm_encoder_attn_backend="not_a_backend") def test_mm_hasher_algorithm_invalid(): with pytest.raises(ValueError, match="mm_hasher_algorithm"): - MultiModalConfig(mm_hasher_algorithm="md5") # type: ignore[arg-type] + MultiModalConfig(mm_hasher_algorithm="md5") def test_mm_encoder_attn_backend_hash_updates(): @@ -560,7 +560,7 @@ def _resolve_mm_processor_device( """Run the `auto` resolution and report where the processor ended up.""" mm_config = MultiModalConfig( mm_processor_kwargs={} if device is None else {"device": device}, - mm_tensor_ipc=mm_tensor_ipc, # type: ignore[arg-type] + mm_tensor_ipc=mm_tensor_ipc, ) model_config = MagicMock(spec=ModelConfig) model_config.multimodal_config = mm_config @@ -662,7 +662,7 @@ def _resolve_mm_video_decode_device( the resulting video media IO kwargs.""" mm_config = MultiModalConfig( mm_processor_kwargs={} if device is None else {"device": device}, - mm_tensor_ipc=mm_tensor_ipc, # type: ignore[arg-type] + mm_tensor_ipc=mm_tensor_ipc, media_io_kwargs={} if video_kwargs is None else {"video": dict(video_kwargs)}, ) model_config = MagicMock(spec=ModelConfig) diff --git a/tests/conftest.py b/tests/conftest.py index c1380f61cd..952c328f91 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1163,7 +1163,7 @@ class VllmRunner: output_logprobs = sample.logprobs if include_prompt_token_ids: outputs.append( - ( # type: ignore[arg-type] + ( output_ids, output_str, output_logprobs, diff --git a/tests/entrypoints/anthropic/test_anthropic_messages_conversion.py b/tests/entrypoints/anthropic/test_anthropic_messages_conversion.py index 23246d4380..d14f24eba0 100644 --- a/tests/entrypoints/anthropic/test_anthropic_messages_conversion.py +++ b/tests/entrypoints/anthropic/test_anthropic_messages_conversion.py @@ -1447,7 +1447,7 @@ class TestDetectMergeInlineSystem: model_config=None, ) assert ( - AnthropicServingMessages._should_merge_inline_system(online_renderer) # type: ignore[arg-type] + AnthropicServingMessages._should_merge_inline_system(online_renderer) is expected ) assert mock_logger.warning_once.called is expected diff --git a/tests/entrypoints/cohere/test_cohere_chat_message.py b/tests/entrypoints/cohere/test_cohere_chat_message.py index 8c297bf19a..2ac30f7188 100644 --- a/tests/entrypoints/cohere/test_cohere_chat_message.py +++ b/tests/entrypoints/cohere/test_cohere_chat_message.py @@ -29,7 +29,7 @@ from vllm.entrypoints.cohere.cohere_chat_message import ( class TestCitationSource: def test_invalid_type_rejected(self): with pytest.raises(ValidationError): - CitationSource(type="other") # type: ignore[arg-type] + CitationSource(type="other") def test_none_fields_excluded_from_dump(self): s = CitationSource(type="document", id="d1") @@ -65,7 +65,7 @@ class TestCitationSource: class TestCitation: def test_invalid_type_rejected(self): with pytest.raises(ValidationError): - Citation(type="OTHER") # type: ignore[arg-type] + Citation(type="OTHER") def test_dump_excludes_none_fields(self): c = Citation(start=0, end=5, text="hello") diff --git a/tests/entrypoints/cohere/test_protocol.py b/tests/entrypoints/cohere/test_protocol.py index 5391686c69..dc37ff7cdd 100644 --- a/tests/entrypoints/cohere/test_protocol.py +++ b/tests/entrypoints/cohere/test_protocol.py @@ -136,7 +136,7 @@ class TestCohereChatV2Response: with pytest.raises(ValidationError): CohereChatV2Response( id="r1", - finish_reason="NOT_A_REASON", # type: ignore[arg-type] + finish_reason="NOT_A_REASON", message=msg, ) @@ -246,5 +246,5 @@ class TestStreamingEventTypeField: MessageStartEvent( id="a", delta={"message": {"role": "assistant"}}, - type="other", # type: ignore[arg-type] + type="other", ) diff --git a/tests/entrypoints/launchers/api_server/test_api_server_process_manager.py b/tests/entrypoints/launchers/api_server/test_api_server_process_manager.py index b4390f2dc4..10858b6da4 100644 --- a/tests/entrypoints/launchers/api_server/test_api_server_process_manager.py +++ b/tests/entrypoints/launchers/api_server/test_api_server_process_manager.py @@ -308,7 +308,7 @@ def test_external_process_monitoring(api_server_args): try: wait_for_completion_or_failure( api_server_manager=manager, - coordinator=mock_coordinator, # type: ignore[arg-type] + coordinator=mock_coordinator, ) except Exception as e: result["exception"] = e @@ -377,7 +377,7 @@ def test_gather_actual_addresses_end_to_end(): manager = APIServerProcessManager( listen_address=f"tcp://{host}:0", sock=sock, - args="test_args", # type: ignore[arg-type] + args="test_args", num_servers=num_servers, input_addresses=placeholder_inputs, output_addresses=placeholder_outputs, @@ -424,7 +424,7 @@ def test_gather_actual_addresses_child_crash_before_report(): manager = APIServerProcessManager( listen_address=f"tcp://{host}:0", sock=sock, - args="test_args", # type: ignore[arg-type] + args="test_args", num_servers=num_servers, input_addresses=placeholder_inputs, output_addresses=placeholder_outputs, diff --git a/tests/entrypoints/multimodal/llm/test_mm_processor_kwargs.py b/tests/entrypoints/multimodal/llm/test_mm_processor_kwargs.py index 9e170c61fc..c03efa8f10 100644 --- a/tests/entrypoints/multimodal/llm/test_mm_processor_kwargs.py +++ b/tests/entrypoints/multimodal/llm/test_mm_processor_kwargs.py @@ -14,7 +14,7 @@ from vllm.outputs import RequestOutput def _make_mock_llm() -> LLM: llm = object.__new__(LLM) - llm.model_config = SimpleNamespace( # type: ignore[assignment] + llm.model_config = SimpleNamespace( runner_type="generate", enable_prompt_embeds=False ) return llm diff --git a/tests/entrypoints/openai/test_render_parity.py b/tests/entrypoints/openai/test_render_parity.py index 2bf4345091..3f4b4b2603 100644 --- a/tests/entrypoints/openai/test_render_parity.py +++ b/tests/entrypoints/openai/test_render_parity.py @@ -225,7 +225,7 @@ def online_renderer(model_config: MockModelConfig, request) -> OnlineRenderer: renderer.tokenizer = MagicMock() return OnlineRenderer( - model_config=model_config, # type: ignore[arg-type] + model_config=model_config, renderer=renderer, request_logger=None, chat_template=None, diff --git a/tests/entrypoints/pooling/embed/test_io_processor.py b/tests/entrypoints/pooling/embed/test_io_processor.py index 15bdcf1d59..3c1329693b 100644 --- a/tests/entrypoints/pooling/embed/test_io_processor.py +++ b/tests/entrypoints/pooling/embed/test_io_processor.py @@ -411,7 +411,7 @@ class TestChunkedEmbeddingProcessing: @classmethod def _make_handler(cls): handler = object.__new__(EmbedIOProcessor) - handler.model_config = cls._FakeModelConfig() # type: ignore[assignment] + handler.model_config = cls._FakeModelConfig() handler.enable_chunked_processing = True return handler diff --git a/tests/entrypoints/pooling/scoring/test_io_processor_unit.py b/tests/entrypoints/pooling/scoring/test_io_processor_unit.py index 7d7b275032..5a0ff9363e 100644 --- a/tests/entrypoints/pooling/scoring/test_io_processor_unit.py +++ b/tests/entrypoints/pooling/scoring/test_io_processor_unit.py @@ -47,7 +47,7 @@ def llm_reranker_processor() -> CrossEncoderIOProcessor: ) processor = CrossEncoderIOProcessor.__new__(CrossEncoderIOProcessor) - processor.model_config = SimpleNamespace(enable_prompt_embeds=False) # type: ignore[assignment] + processor.model_config = SimpleNamespace(enable_prompt_embeds=False) processor.tokenizer = TokenizersBackend( tokenizer_object=backend, unk_token="[UNK]", @@ -96,7 +96,7 @@ def test_token_type_ids_stay_aligned_with_a_truncated_padded_prompt(): ) processed_prompt = tok_params.apply_post_tokenization( - tokenizer, # type: ignore[arg-type] + tokenizer, prompt, ) assert "prompt_token_ids" in processed_prompt diff --git a/tests/entrypoints/pooling/scoring/test_jina_ranking_io_processor_unit.py b/tests/entrypoints/pooling/scoring/test_jina_ranking_io_processor_unit.py index ee535ced23..e69dd6d45a 100644 --- a/tests/entrypoints/pooling/scoring/test_jina_ranking_io_processor_unit.py +++ b/tests/entrypoints/pooling/scoring/test_jina_ranking_io_processor_unit.py @@ -77,10 +77,8 @@ def offline_processor_and_context(): backend.pre_tokenizer = pre_tokenizers.WhitespaceSplit() proc = JinaRankingIOProcessor.__new__(JinaRankingIOProcessor) proc.tokenizer = TokenizersBackend(tokenizer_object=backend) - proc.model_config = SimpleNamespace( # type: ignore[assignment] - max_model_len=1024, is_encoder_decoder=False - ) - proc.renderer = SimpleNamespace( # type: ignore[assignment] + proc.model_config = SimpleNamespace(max_model_len=1024, is_encoder_decoder=False) + proc.renderer = SimpleNamespace( default_cmpl_tok_params=TokenizeParams(max_total_tokens=1024) ) ctx = OfflineScoringInputsContext( diff --git a/tests/entrypoints/pooling/test_io_processor.py b/tests/entrypoints/pooling/test_io_processor.py index d5b4909499..9d2207fdf1 100644 --- a/tests/entrypoints/pooling/test_io_processor.py +++ b/tests/entrypoints/pooling/test_io_processor.py @@ -53,8 +53,8 @@ def test_rejects_mismatched_lora_requests(processor: PoolingIOProcessor): def test_rejects_conflicting_pooling_task(processor: PoolingIOProcessor): - processor.model_config = SimpleNamespace(is_encoder_decoder=False) # type: ignore[assignment] - processor.renderer = SimpleNamespace( # type: ignore[assignment] # Tokenization defaults only. + processor.model_config = SimpleNamespace(is_encoder_decoder=False) + processor.renderer = SimpleNamespace( default_cmpl_tok_params=TokenizeParams(max_total_tokens=None) ) ctx = OfflineEncodeInputsContext( diff --git a/tests/entrypoints/serve/middleware/test_authentication_middleware.py b/tests/entrypoints/serve/middleware/test_authentication_middleware.py index a65db9a0be..27a783a451 100644 --- a/tests/entrypoints/serve/middleware/test_authentication_middleware.py +++ b/tests/entrypoints/serve/middleware/test_authentication_middleware.py @@ -87,7 +87,7 @@ def task_routes(request, monkeypatch) -> tuple[str, list[tuple[str, list[str]]]] args, app, supported_tasks=(task,), - model_config=MockModelConfig(), # type: ignore[arg-type] + model_config=MockModelConfig(), ) routes = get_all_http_routes(app) diff --git a/tests/entrypoints/serve/tokenize/test_tokenization.py b/tests/entrypoints/serve/tokenize/test_tokenization.py index bf51d8dee7..1f7e250576 100644 --- a/tests/entrypoints/serve/tokenize/test_tokenization.py +++ b/tests/entrypoints/serve/tokenize/test_tokenization.py @@ -107,7 +107,7 @@ async def test_tokenize_chat( conversation=conversation, tokenize=False, ) - tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type] + tokens = tokenizer.encode(prompt, add_special_tokens=add_special) response = requests.post( server.url_for("tokenize"), @@ -176,7 +176,7 @@ async def test_tokenize_chat_with_tools( tools=tools, tokenize=False, ) - tokens = tokenizer.encode(prompt, add_special_tokens=add_special) # type: ignore[arg-type] + tokens = tokenizer.encode(prompt, add_special_tokens=add_special) response = requests.post( server.url_for("tokenize"), diff --git a/tests/entrypoints/speech_to_text/transcription/test_qwen3_asr_sanitize_prompt.py b/tests/entrypoints/speech_to_text/transcription/test_qwen3_asr_sanitize_prompt.py index 3dbc1e0f96..254bc28f29 100644 --- a/tests/entrypoints/speech_to_text/transcription/test_qwen3_asr_sanitize_prompt.py +++ b/tests/entrypoints/speech_to_text/transcription/test_qwen3_asr_sanitize_prompt.py @@ -47,7 +47,7 @@ def test_sanitize_handles_falsy_inputs() -> None: assert _sanitize_transcription_user_text("") == "" # The dataclass default for ``response_prefix`` is the empty string; # the sanitizer must accept that without exception or extra work. - assert _sanitize_transcription_user_text(None) == "" # type: ignore[arg-type] + assert _sanitize_transcription_user_text(None) == "" def test_sanitize_is_idempotent() -> None: diff --git a/tests/entrypoints/unit_tests/test_chat_utils.py b/tests/entrypoints/unit_tests/test_chat_utils.py index 0493803a54..75867f04b2 100644 --- a/tests/entrypoints/unit_tests/test_chat_utils.py +++ b/tests/entrypoints/unit_tests/test_chat_utils.py @@ -216,7 +216,7 @@ def video_url(): @pytest.fixture(scope="module") def audio_url(): audio = AudioAsset("mary_had_lamb") - return encode_audio_url(*audio.audio_and_sample_rate) # type: ignore[arg-type] + return encode_audio_url(*audio.audio_and_sample_rate) def _assert_mm_data_is_image_input( @@ -3194,5 +3194,5 @@ def test_validate_chat_template_rejects_invalid_type(): with pytest.raises( VLLMValidationError, match="not a valid chat template type" ) as exc_info: - validate_chat_template(123) # type: ignore[arg-type] + validate_chat_template(123) assert exc_info.value.parameter == "chat_template" diff --git a/tests/jit_monitor/test_hooks.py b/tests/jit_monitor/test_hooks.py index 48cd9fd0f6..452fe96995 100644 --- a/tests/jit_monitor/test_hooks.py +++ b/tests/jit_monitor/test_hooks.py @@ -149,7 +149,7 @@ def test_activate_logs_info(): def test_activate_rejects_unknown_mode(): with pytest.raises(ValueError, match="Unsupported JIT monitor mode"): - jit_monitor.activate(mode="panic") # type: ignore[arg-type] + jit_monitor.activate(mode="panic") def test_activate_without_triton(): diff --git a/tests/kernels/attention/test_attention_selector.py b/tests/kernels/attention/test_attention_selector.py index 9144928f91..24f02836e9 100644 --- a/tests/kernels/attention/test_attention_selector.py +++ b/tests/kernels/attention/test_attention_selector.py @@ -23,12 +23,12 @@ from vllm.platforms.interface import DeviceCapability if current_platform.is_cuda(): from vllm.platforms.cuda import CudaPlatform else: - CudaPlatform = None # type: ignore[assignment] # Unavailable platform import. + CudaPlatform = None if current_platform.is_rocm(): from vllm.platforms.rocm import RocmPlatform else: - RocmPlatform = None # type: ignore[misc, assignment] # Unavailable platform import. + RocmPlatform = None # type: ignore[misc] # Unavailable platform import. from vllm.v1.attention.backend import AttentionType from vllm.v1.attention.backends.registry import AttentionBackendEnum @@ -356,14 +356,14 @@ def test_invalid_backend(): def test_auto_backend_string(auto_value: str): """Test that 'auto' string value triggers automatic backend selection.""" # Using "auto" should result in backend=None (automatic selection) - attention_config = AttentionConfig(backend=auto_value) # type: ignore[arg-type] + attention_config = AttentionConfig(backend=auto_value) assert attention_config.backend is None def test_auto_backend_selection_behavior(): """Test that 'auto' backend behaves same as None (automatic selection).""" # Create config with explicit "auto" - auto_config = AttentionConfig(backend="auto") # type: ignore[arg-type] + auto_config = AttentionConfig(backend="auto") # Create config with None (default) none_config = AttentionConfig(backend=None) diff --git a/tests/kernels/attention/test_cpu_attn.py b/tests/kernels/attention/test_cpu_attn.py index 1aa5b056c4..f79b1b15d2 100644 --- a/tests/kernels/attention/test_cpu_attn.py +++ b/tests/kernels/attention/test_cpu_attn.py @@ -836,7 +836,7 @@ def varlen_encoder_zentorch_sdpa( key, value, output, - SimpleNamespace(query_start_loc=query_start_loc, causal=False), # type: ignore[arg-type] + SimpleNamespace(query_start_loc=query_start_loc, causal=False), scale, sliding_window if sliding_window is not None else -1, alibi_slopes, diff --git a/tests/kernels/attention/test_minimax_m3.py b/tests/kernels/attention/test_minimax_m3.py index 62fcb0beba..e3e4897e15 100644 --- a/tests/kernels/attention/test_minimax_m3.py +++ b/tests/kernels/attention/test_minimax_m3.py @@ -1782,7 +1782,7 @@ def test_aiter_indexer_requires_the_aiter_attend(monkeypatch): num_index_heads=1, index_head_dim=HEAD_DIM, # The implementation also accepts this legacy fp8 alias. - indexer_kv_dtype="fp8_e4m3", # type: ignore[arg-type] + indexer_kv_dtype="fp8_e4m3", max_model_len=8192, ) diff --git a/tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py b/tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py index c3dee9b580..5c94968ddc 100644 --- a/tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py +++ b/tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py @@ -235,14 +235,14 @@ def test_msa_metadata_builder_prepares_cutlass_for_regular_decode( builder.num_q_heads = 64 builder.num_kv_heads = 4 builder.topk_blocks = TOPK - builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4) # type: ignore[assignment] + builder.kv_cache_spec = SimpleNamespace(num_kv_heads=4) builder.kv_cache_dtype = "fp8_e4m3" builder.decode_backend = "cutlass" - builder.msa_cutlass_plan_cache = object() # type: ignore[assignment] # Mocked plan-cache sentinel. + builder.msa_cutlass_plan_cache = object() metadata = builder.build( 0, - SimpleNamespace( # type: ignore[arg-type] + SimpleNamespace( seq_lens_cpu_upper_bound=torch.full((batch,), 257, dtype=torch.int32) ), ) @@ -377,7 +377,7 @@ def test_query_fp8_stays_valid_when_cutlass_plan_appears_on_replay( with torch.cuda.stream(stream), override_forward_context(forward_context): capture = BreakableCUDAGraphCapture() with capture: - query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv) # type: ignore[arg-type] + query_fp8 = MiniMaxM3SparseAttention._allocate_query_fp8(attention, qkv) if query_fp8 is not None: query_fp8.zero_() run_attention(query_fp8) @@ -387,7 +387,7 @@ def test_query_fp8_stays_valid_when_cutlass_plan_appears_on_replay( assert capture.num_eager_breaks == 1 assert observed_ptrs == [] - decode.msa_cutlass = object() # type: ignore[assignment] + decode.msa_cutlass = object() for _ in range(3): capture.replay() stream.synchronize() diff --git a/tests/kernels/attention/test_rocm_aiter_mla_causal_verify_mask.py b/tests/kernels/attention/test_rocm_aiter_mla_causal_verify_mask.py index 9193c03608..757fd186a6 100644 --- a/tests/kernels/attention/test_rocm_aiter_mla_causal_verify_mask.py +++ b/tests/kernels/attention/test_rocm_aiter_mla_causal_verify_mask.py @@ -204,7 +204,7 @@ def _run_verify_block(): ), ): assert isinstance(impl, AiterMLAImpl) - impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None) # type: ignore[arg-type] # Spy decode path does not read layer. + impl.forward_mqa((q_nope, q_pe), kv_cache, metadata, layer=None) return metadata, captured diff --git a/tests/kernels/attention/test_rocm_aiter_mla_fp8_prefill.py b/tests/kernels/attention/test_rocm_aiter_mla_fp8_prefill.py index fe97013b25..23dd09128b 100644 --- a/tests/kernels/attention/test_rocm_aiter_mla_fp8_prefill.py +++ b/tests/kernels/attention/test_rocm_aiter_mla_fp8_prefill.py @@ -121,7 +121,7 @@ def _build_prefill_metadata( builder = object.__new__(AiterMLAMetadataBuilder) builder.num_heads = num_heads - builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM) # type: ignore[assignment] + builder.mla_dims = SimpleNamespace(v_head_dim=V_HEAD_DIM) builder._init_fp8_prefill_ps_buffers( max_num_reqs=len(seq_lens), max_prefill_qlen=max_q, @@ -136,7 +136,7 @@ def _build_prefill_metadata( prefill = SimpleNamespace(query_start_loc=qo_indptr, max_query_len=max_q) metadata = SimpleNamespace(prefill=prefill, num_decodes=0) common = SimpleNamespace(query_start_loc_cpu=qo_indptr_cpu) - builder._build_fp8_prefill_ps_metadata(metadata, common) # type: ignore[arg-type] + builder._build_fp8_prefill_ps_metadata(metadata, common) return metadata, total_q, builder diff --git a/tests/kernels/attention/test_rocm_aiter_mla_sink.py b/tests/kernels/attention/test_rocm_aiter_mla_sink.py index 354800d048..40b888c362 100644 --- a/tests/kernels/attention/test_rocm_aiter_mla_sink.py +++ b/tests/kernels/attention/test_rocm_aiter_mla_sink.py @@ -170,7 +170,7 @@ def test_sparse_mla_sink_matches_ragged_reference( SimpleNamespace(_q_scale=q_scale, _k_scale=kv_scale), q, kv, - metadata, # type: ignore[arg-type] + metadata, ) kv_flat = kv_ref[:, 0] references = [] @@ -244,7 +244,7 @@ def test_sparse_mla_sink_rejects_unsupported_aiter_dtypes( SimpleNamespace(_q_scale=None, _k_scale=None), torch.empty(1, 16, Q_HEAD_DIM, dtype=q_dtype), torch.empty(1, 1, Q_HEAD_DIM, dtype=kv_dtype), - metadata, # type: ignore[arg-type] + metadata, ) @@ -384,7 +384,7 @@ def test_sparse_mla_sink_matches_dense_attention_with_empty_rows_and_paged_cache paged_kv_indices=torch.tensor(indices, dtype=torch.int32, device="cuda"), paged_kv_indptr=lengths.cumsum(0).to(device="cuda", dtype=torch.int32), ) - impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl) # type: ignore[arg-type] + impl = ROCMAiterMLASparseImpl.__new__(ROCMAiterMLASparseImpl) impl.num_heads = num_heads impl.head_size = head_dim impl.kv_lora_rank = value_dim @@ -441,9 +441,9 @@ def test_sparse_mla_backend_resolves_only_contiguous_layer_layouts(monkeypatch, ] if layout == "BLNHC": with pytest.raises(ValueError, match="does not satisfy"): - resolve_kv_cache_layout(config, supported) # type: ignore[arg-type] + resolve_kv_cache_layout(config, supported) else: - assert resolve_kv_cache_layout(config, supported).name == layout # type: ignore[arg-type] + assert resolve_kv_cache_layout(config, supported).name == layout @pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float16]) @@ -494,7 +494,7 @@ def test_sparse_mla_sink_forward_mqa_preserves_split_query(dtype): actual, _ = impl.forward_mqa( (q[..., :V_HEAD_DIM], q[..., V_HEAD_DIM:]), kv, - metadata, # type: ignore[arg-type] + metadata, SimpleNamespace(_q_scale=None, _k_scale=None), ) references = [ diff --git a/tests/kernels/attention/test_rocm_aiter_mla_sparse_metadata_sync.py b/tests/kernels/attention/test_rocm_aiter_mla_sparse_metadata_sync.py index c71536a448..aabce97fac 100644 --- a/tests/kernels/attention/test_rocm_aiter_mla_sparse_metadata_sync.py +++ b/tests/kernels/attention/test_rocm_aiter_mla_sparse_metadata_sync.py @@ -39,10 +39,10 @@ def _make_builder(): topk_tokens = 4 builder.device = torch.device("cpu") - builder.kv_cache_spec = SimpleNamespace(block_size=1) # type: ignore[assignment] + builder.kv_cache_spec = SimpleNamespace(block_size=1) builder.model_dtype = torch.bfloat16 builder.kv_cache_dtype = "fp8" - builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64) # type: ignore[assignment] + builder.mla_dims = SimpleNamespace(kv_lora_rank=512, qk_rope_head_dim=64) builder.topk_tokens = topk_tokens builder.req_id_per_token_buffer = torch.zeros( max_num_batched_tokens, dtype=torch.int32, device="cpu" diff --git a/tests/kernels/attention/test_rocm_paged_mxfp4_indexer.py b/tests/kernels/attention/test_rocm_paged_mxfp4_indexer.py index b37433cd90..311ee89a8d 100644 --- a/tests/kernels/attention/test_rocm_paged_mxfp4_indexer.py +++ b/tests/kernels/attention/test_rocm_paged_mxfp4_indexer.py @@ -227,9 +227,7 @@ def _decode_metadata(case, rows, ratio, query_lens): num_decode_tokens=len(rows), num_prefills=0, num_prefill_tokens=0, - decode=types.SimpleNamespace( # type: ignore[arg-type] - block_table=block_table, seq_lens=lens[:, None] - ), + decode=types.SimpleNamespace(block_table=block_table, seq_lens=lens[:, None]), decode_row_lens=lens, decode_block_ends=(lens + CAND_BLOCK - 1) // CAND_BLOCK, decode_native=native, @@ -280,7 +278,7 @@ def _prefill_metadata( num_decode_tokens=0, num_prefills=len(case.seq_lens), num_prefill_tokens=len(rows), - prefill=types.SimpleNamespace(chunks=chunks), # type: ignore[arg-type] + prefill=types.SimpleNamespace(chunks=chunks), prefill_plans=plans, gather_launches=plan_gather_launches(chunks, plans, gather_rows), ) diff --git a/tests/kernels/attention/test_rocm_triton_attn_dsv4.py b/tests/kernels/attention/test_rocm_triton_attn_dsv4.py index b6e41876b6..387e690e1b 100644 --- a/tests/kernels/attention/test_rocm_triton_attn_dsv4.py +++ b/tests/kernels/attention/test_rocm_triton_attn_dsv4.py @@ -955,7 +955,7 @@ def test_rocm_capture_metadata_sets_adaptive_marker(monkeypatch) -> None: ) builder = object.__new__(rocm_mod.DeepseekV4ROCMAiterMLASparseMetadataBuilder) - actual = builder.build_for_cudagraph_capture(SimpleNamespace()) # type: ignore[arg-type] # Patched base method ignores metadata. + actual = builder.build_for_cudagraph_capture(SimpleNamespace()) assert actual is metadata assert actual.for_cudagraph_capture is _on_gfx950() @@ -1563,7 +1563,7 @@ def test_dsv4_adaptive_mla_swa_metadata_graph_replay(monkeypatch) -> None: "sliding_window": window_size, }, ) - vllm_config.speculative_config = SimpleNamespace( # type: ignore[assignment] + vllm_config.speculative_config = SimpleNamespace( num_speculative_tokens=upper_query_len - 1, parallel_drafting=False, enable_adaptive_verification=True, diff --git a/tests/kernels/mamba/test_gdn_forward_core_split.py b/tests/kernels/mamba/test_gdn_forward_core_split.py index b1c3030380..8a99e223be 100644 --- a/tests/kernels/mamba/test_gdn_forward_core_split.py +++ b/tests/kernels/mamba/test_gdn_forward_core_split.py @@ -176,7 +176,7 @@ def test_forward_core_split_matches_unified( builder = GDNAttentionMetadataBuilder( # GDNAttentionMetadataBuilder declares kv_cache_spec as AttentionSpec but # asserts isinstance(kv_cache_spec, MambaSpec). MambaSpec is correct here. - kv_cache_spec=MambaSpec( # type: ignore[arg-type] + kv_cache_spec=MambaSpec( block_size=BLOCK_SIZE, shapes=((16, 64),), dtypes=(torch.float16,) ), layer_names=[PREFIX], diff --git a/tests/kernels/moe/test_cutlass_moe.py b/tests/kernels/moe/test_cutlass_moe.py index 9a5189f592..1910796623 100644 --- a/tests/kernels/moe/test_cutlass_moe.py +++ b/tests/kernels/moe/test_cutlass_moe.py @@ -538,7 +538,7 @@ def run_8_bit( assert num_local_experts is not None return run_with_expert_maps( num_experts, - num_local_experts, # type: ignore[arg-type] + num_local_experts, quant_config, **kwargs, ) diff --git a/tests/kernels/moe/test_ocp_mx_moe.py b/tests/kernels/moe/test_ocp_mx_moe.py index 295a92482f..f574c4d5d1 100644 --- a/tests/kernels/moe/test_ocp_mx_moe.py +++ b/tests/kernels/moe/test_ocp_mx_moe.py @@ -1724,7 +1724,7 @@ def test_rocm_mxfp4_moe_oracle( w13_conv, w2_conv, w13_scale_conv, w2_scale_conv, w13_bias_conv, w2_bias_conv = ( convert_gpt_oss_weight_to_mxfp4_moe_kernel_format( mxfp4_backend=backend, - layer=layer, # type: ignore[arg-type] + layer=layer, w13_weight=w13_quant, w2_weight=w2_quant, w13_weight_scale=w13_scale, diff --git a/tests/kernels/quantization/test_block_fp8.py b/tests/kernels/quantization/test_block_fp8.py index 7d139644e7..fe2622693b 100644 --- a/tests/kernels/quantization/test_block_fp8.py +++ b/tests/kernels/quantization/test_block_fp8.py @@ -259,7 +259,7 @@ def test_w8a8_block_fp8_torch_scaled_mm_matmul(): stub = BlockWiseTorchFP8ScaledMMLinearKernel.__new__( BlockWiseTorchFP8ScaledMMLinearKernel ) - stub.config = types.SimpleNamespace(out_dtype=out_dtype) # type: ignore[assignment] + stub.config = types.SimpleNamespace(out_dtype=out_dtype) out = stub.apply_block_scaled_mm( A_fp8_cuda.cuda(), B_fp8.cuda(), As_cuda.cuda(), Bs.cuda() ) diff --git a/tests/kernels/quantization/test_cutlass_w4a8.py b/tests/kernels/quantization/test_cutlass_w4a8.py index 1bb63ae8be..968d5f2c74 100644 --- a/tests/kernels/quantization/test_cutlass_w4a8.py +++ b/tests/kernels/quantization/test_cutlass_w4a8.py @@ -208,7 +208,7 @@ def mm_test_helper( a=tensors.a, b_q=tensors.w_q, b_group_scales=tensors.w_g_s, - b_group_size=group_size, # type: ignore[arg-type] + b_group_size=group_size, b_channel_scales=tensors.w_ch_s, a_token_scales=tensors.w_tok_s, ) diff --git a/tests/kernels/quantization/test_marlin_tile_padding.py b/tests/kernels/quantization/test_marlin_tile_padding.py index ef5911decd..b5863008ed 100644 --- a/tests/kernels/quantization/test_marlin_tile_padding.py +++ b/tests/kernels/quantization/test_marlin_tile_padding.py @@ -525,15 +525,13 @@ def test_check_marlin_supports_layer_allow_tile_padding(): ) # Tile-misaligned but group-aligned: rejected strictly, allowed w/ padding - layer: LinearBase = _FakeLinear( # type: ignore[assignment] - 4640, 512, input_size=2048 - ) + layer: LinearBase = _FakeLinear(4640, 512, input_size=2048) assert not check_marlin_supports_layer(layer, 128) assert check_marlin_supports_layer(layer, 128, allow_tile_padding=True) assert check_marlin_supports_layer(layer, -1, allow_tile_padding=True) # A group straddling the TP shard cannot be fixed by padding - layer = _FakeLinear(4608, 4672, input_size=18688) # type: ignore[assignment] + layer = _FakeLinear(4608, 4672, input_size=18688) assert not check_marlin_supports_layer(layer, 128, allow_tile_padding=True) diff --git a/tests/kernels/quantization/test_nvfp4_emulation.py b/tests/kernels/quantization/test_nvfp4_emulation.py index 0e005760b0..3a136484ac 100644 --- a/tests/kernels/quantization/test_nvfp4_emulation.py +++ b/tests/kernels/quantization/test_nvfp4_emulation.py @@ -206,7 +206,7 @@ def test_nvfp4_emulation_support_check_rejects_bias_and_lora( in_dtype=torch.bfloat16, device="cuda", routing_method=RoutingMethodType.TopK, - **config_kwargs, # type: ignore[arg-type] + **config_kwargs, ) supported, reason = Nvfp4QuantizationEmulationTritonExperts.is_supported_config( diff --git a/tests/model_executor/layers/test_fused_shared_expert.py b/tests/model_executor/layers/test_fused_shared_expert.py index 89502fbf9d..6721a4c63b 100644 --- a/tests/model_executor/layers/test_fused_shared_expert.py +++ b/tests/model_executor/layers/test_fused_shared_expert.py @@ -413,7 +413,7 @@ def test_deepseek_v4_shared_expert_fse_uses_mtp_quantization_config_prefix( ) compatible, reason = is_shared_expert_quant_fse_compatible( - DeepseekV4Config(), # type: ignore[arg-type] + DeepseekV4Config(), "model.layers.2.ffn.experts", "model.layers.2.ffn.shared_experts", ) @@ -824,7 +824,7 @@ def test_models_fse_init( model_type, quantization_config ) vllm_config = VllmConfig() - vllm_config.model_config = SimpleNamespace( # type: ignore[assignment] + vllm_config.model_config = SimpleNamespace( hf_config=config, hf_text_config=config, dtype=torch.bfloat16, @@ -893,7 +893,7 @@ def test_models_fse_init( DeepSeekV4MTP, ) - vllm_config.speculative_config = SimpleNamespace( # type: ignore[assignment] + vllm_config.speculative_config = SimpleNamespace( draft_model_config=SimpleNamespace(hf_config=config), method="mtp", parallel_drafting=False, diff --git a/tests/model_executor/layers/test_mla_short_prefill_indexer.py b/tests/model_executor/layers/test_mla_short_prefill_indexer.py index 70243e5557..77c52fb291 100644 --- a/tests/model_executor/layers/test_mla_short_prefill_indexer.py +++ b/tests/model_executor/layers/test_mla_short_prefill_indexer.py @@ -46,7 +46,7 @@ def test_sparse_attention_refreshes_batch_state_inside_eager_segment( with pytest.raises(BatchStateRefreshed): DeepseekV32Attention._sparse_indexer_and_attn( - layer, # type: ignore[arg-type] + layer, torch.empty(1, dtype=torch.long), torch.empty(1, 1), torch.empty(1, 1, 1), @@ -80,7 +80,7 @@ def make_indexer_metadata( num_decode_tokens=num_decode_tokens, num_prefills=num_prefills, num_prefill_tokens=num_prefill_tokens, - prefill=SimpleNamespace(chunks=[]) if num_prefills else None, # type: ignore[arg-type] + prefill=SimpleNamespace(chunks=[]) if num_prefills else None, ) @@ -129,7 +129,7 @@ def test_short_prefill_updates_k_cache_before_scoring_decision( slot_mapping=slot_mapping, ) if indexer_metadata.num_decodes: - indexer_metadata.decode = object() # type: ignore[assignment] + indexer_metadata.decode = object() mla_metadata = make_mla_metadata( use_dense_mha=batch_kind != "force_mqa", num_decode_tokens=mla_num_decode_tokens, @@ -307,7 +307,7 @@ def test_deepseek_v32_dispatches_selected_mha( output = torch.empty(2, 2) DeepseekV32Attention._sparse_indexer_and_attn( - layer, # type: ignore[arg-type] + layer, torch.arange(2), torch.empty(2, 2), q_nope, diff --git a/tests/model_executor/layers/test_pooler_activations.py b/tests/model_executor/layers/test_pooler_activations.py index 381d267583..697207a68b 100644 --- a/tests/model_executor/layers/test_pooler_activations.py +++ b/tests/model_executor/layers/test_pooler_activations.py @@ -224,11 +224,11 @@ class TestResolveClassifierActFn: model_config = SimpleNamespace( hf_config=SimpleNamespace(num_labels=3, problem_type="") ) - result = resolve_classifier_act_fn(model_config, act_fn=None) # type: ignore[arg-type] + result = resolve_classifier_act_fn(model_config, act_fn=None) assert isinstance(result, PoolerClassify) assert result.num_labels == 3 def test_passes_through_provided_act_fn(self): custom = PoolerIdentity() - result = resolve_classifier_act_fn(None, act_fn=custom) # type: ignore[arg-type] + result = resolve_classifier_act_fn(None, act_fn=custom) assert result is custom diff --git a/tests/model_executor/layers/test_pooler_methods.py b/tests/model_executor/layers/test_pooler_methods.py index bfe2cf0aed..75bbed4f37 100644 --- a/tests/model_executor/layers/test_pooler_methods.py +++ b/tests/model_executor/layers/test_pooler_methods.py @@ -320,7 +320,7 @@ def test_dispatch_seq_cls_honors_token_pooling_type(tok_pooling_type): ), ) classifier = torch.nn.Linear(4, 3) - with set_current_vllm_config(config): # type: ignore[arg-type] + with set_current_vllm_config(config): pooler = DispatchPooler.for_seq_cls(pooler_config, classifier=classifier) token_ids = [[2, 99, 3, 99], [4, 99], [5, 6]] diff --git a/tests/model_executor/model_loader/tensorizer_loader/test_tensorizer.py b/tests/model_executor/model_loader/tensorizer_loader/test_tensorizer.py index 7047ba1c17..070c832967 100644 --- a/tests/model_executor/model_loader/tensorizer_loader/test_tensorizer.py +++ b/tests/model_executor/model_loader/tensorizer_loader/test_tensorizer.py @@ -36,7 +36,7 @@ try: import tensorizer from tensorizer import EncryptionParams except ImportError: - tensorizer = PlaceholderModule("tensorizer") # type: ignore[assignment] + tensorizer = PlaceholderModule("tensorizer") EncryptionParams = tensorizer.placeholder_attr("EncryptionParams") diff --git a/tests/model_executor/model_loader/test_weight_cache.py b/tests/model_executor/model_loader/test_weight_cache.py index 106b9690ac..731c732625 100644 --- a/tests/model_executor/model_loader/test_weight_cache.py +++ b/tests/model_executor/model_loader/test_weight_cache.py @@ -368,4 +368,4 @@ def test_ipc_loader_copy_mode_reports_no_external_weight_memory(): load_format="ipc_cache", model_loader_extra_config={"mode": "copy"} ) loader = IpcModelLoader(copy_mode) - assert loader.get_external_weight_memory(None) == 0 # type: ignore[arg-type] + assert loader.get_external_weight_memory(None) == 0 diff --git a/tests/models/language/generation/test_mistral.py b/tests/models/language/generation/test_mistral.py index fc774bc6e8..ba908c23c5 100644 --- a/tests/models/language/generation/test_mistral.py +++ b/tests/models/language/generation/test_mistral.py @@ -259,7 +259,7 @@ def test_mistral_function_calling(vllm_runner, model: str, dtype: str) -> None: model_output = outputs[0].outputs[0].text.strip() assert model_output.startswith(tool_parser.bot_token), model_output - parsed_message = tool_parser.extract_tool_calls(model_output, None) # type: ignore[arg-type] + parsed_message = tool_parser.extract_tool_calls(model_output, None) assert parsed_message.tools_called @@ -302,7 +302,7 @@ def test_mistral_function_call_nested_json(): model_output = f"{parser.bot_token}get_current_weather{json.dumps(args_dict)}" - parsed = parser.extract_tool_calls(model_output, None) # type: ignore[arg-type] + parsed = parser.extract_tool_calls(model_output, None) # Assertions: the tool call is detected and the full nested JSON is parsed # without truncation. @@ -335,7 +335,7 @@ def test_mistral_function_call_nested_json(): ] ) - parsed = parser.extract_tool_calls(model_output, None) # type: ignore[arg-type] + parsed = parser.extract_tool_calls(model_output, None) # Assertions: the tool call is detected and the full nested JSON is parsed # without truncation. diff --git a/tests/models/multimodal/generation/vlm_utils/model_utils.py b/tests/models/multimodal/generation/vlm_utils/model_utils.py index 1a7931082a..bc472c400f 100644 --- a/tests/models/multimodal/generation/vlm_utils/model_utils.py +++ b/tests/models/multimodal/generation/vlm_utils/model_utils.py @@ -1193,7 +1193,7 @@ def voxtral_patch_hf_runner(hf_model: "HfRunner") -> "HfRunner": output.sequences = output.sequences[:, prompt_len:] return output - hf_model.get_inputs = patched_get_inputs # type: ignore[method-assign, assignment] + hf_model.get_inputs = patched_get_inputs # type: ignore[method-assign] hf_model.model.generate = patched_generate # type: ignore[method-assign] return hf_model diff --git a/tests/models/multimodal/pooling/test_clip.py b/tests/models/multimodal/pooling/test_clip.py index 9c500fd6a3..72843105ba 100644 --- a/tests/models/multimodal/pooling/test_clip.py +++ b/tests/models/multimodal/pooling/test_clip.py @@ -132,7 +132,7 @@ def test_models( _run_test( hf_runner, vllm_runner, - input_cases, # type: ignore[arg-type] + input_cases, model, dtype=dtype, ) diff --git a/tests/models/multimodal/pooling/test_llama_nemotron_vl.py b/tests/models/multimodal/pooling/test_llama_nemotron_vl.py index 2a0ba96722..e9e58d8635 100644 --- a/tests/models/multimodal/pooling/test_llama_nemotron_vl.py +++ b/tests/models/multimodal/pooling/test_llama_nemotron_vl.py @@ -190,7 +190,7 @@ def test_models( _run_test( hf_runner, vllm_runner, - input_cases, # type: ignore[arg-type] + input_cases, model, dtype=dtype, ) diff --git a/tests/models/multimodal/pooling/test_siglip.py b/tests/models/multimodal/pooling/test_siglip.py index df9bb61353..a3afe8491e 100644 --- a/tests/models/multimodal/pooling/test_siglip.py +++ b/tests/models/multimodal/pooling/test_siglip.py @@ -149,7 +149,7 @@ def test_models( _run_test( hf_runner, vllm_runner, - input_cases, # type: ignore[arg-type] + input_cases, model, dtype=dtype, ) diff --git a/tests/models/multimodal/processing/test_qwen2_vl.py b/tests/models/multimodal/processing/test_qwen2_vl.py index b957ebf2c8..133880b081 100644 --- a/tests/models/multimodal/processing/test_qwen2_vl.py +++ b/tests/models/multimodal/processing/test_qwen2_vl.py @@ -106,7 +106,7 @@ def test_merge_and_resolve_mm_processor_kwargs_preserves_request_alias_precedenc mm_device_do_normalize=False, ) model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config) - ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type] + ctx = InputProcessingContext(model_config, tokenizer=None) info = Qwen2VLProcessingInfo(ctx) monkeypatch.setattr( info, @@ -236,7 +236,7 @@ def test_get_vision_info_reads_merged_modality_scope( do_resize=False, image_processor=image_processor, mm_kwargs={}, - modality=modality, # type: ignore[arg-type] + modality=modality, ) assert seen == [merged[scope]] diff --git a/tests/models/transformers/test_backend.py b/tests/models/transformers/test_backend.py index fa5e14eddd..2064f01e0c 100644 --- a/tests/models/transformers/test_backend.py +++ b/tests/models/transformers/test_backend.py @@ -260,7 +260,7 @@ def test_quantization( model, model_impl="auto", enforce_eager=True, - **quantization_kwargs, # type: ignore[arg-type] + **quantization_kwargs, ) as vllm_model: vllm_outputs = vllm_model.generate_greedy_logprobs( example_prompts, max_tokens=max_tokens, num_logprobs=num_logprobs @@ -270,7 +270,7 @@ def test_quantization( model, model_impl="transformers", enforce_eager=True, - **quantization_kwargs, # type: ignore[arg-type] + **quantization_kwargs, ) as vllm_model: model_config = vllm_model.llm.llm_engine.model_config assert model_config.using_transformers_backend() diff --git a/tests/multimodal/media/test_video.py b/tests/multimodal/media/test_video.py index 9fbe2f5792..a2fedb1747 100644 --- a/tests/multimodal/media/test_video.py +++ b/tests/multimodal/media/test_video.py @@ -385,7 +385,7 @@ def test_pynvvideocodec_unrelated_error_propagates( PyNvVideoCodecVideoBackendMixin.decode_frames_pynvvideocodec( None, b"video", - None, # type: ignore[arg-type] # Fails before target metadata is used. + None, ) assert exc_info.value is original_error diff --git a/tests/multimodal/test_audio.py b/tests/multimodal/test_audio.py index 379fc3b0ba..24d925aa02 100644 --- a/tests/multimodal/test_audio.py +++ b/tests/multimodal/test_audio.py @@ -179,7 +179,7 @@ def test_audio_resampler_invalid_method(dummy_audio): # Validated eagerly so a bad method fails at construction, not on the # first audio request. with pytest.raises(ValueError, match="Invalid resampling method"): - AudioResampler(target_sr=22050, method="invalid") # type: ignore[arg-type] + AudioResampler(target_sr=22050, method="invalid") def test_audio_resampler_no_target_sr(dummy_audio): diff --git a/tests/multimodal/test_cache.py b/tests/multimodal/test_cache.py index da6b0369b4..2899d15ad0 100644 --- a/tests/multimodal/test_cache.py +++ b/tests/multimodal/test_cache.py @@ -276,14 +276,14 @@ def test_oversized_item_is_served_uncached(): item = MultiModalKwargsItem.dummy(nbytes=4096) small = MultiModalKwargsItem.dummy(nbytes=64) - p0_only = MultiModalProcessorOnlyCache(model_config) # type: ignore[arg-type] + p0_only = MultiModalProcessorOnlyCache(model_config) assert p0_only.get_and_update_item((item, []), "big")[0] is item assert not p0_only.is_cached_item("big") assert p0_only.get_and_update_item((small, []), "small")[0] is small assert p0_only.is_cached_item("small") - p0 = LruKeyReplicatedSenderCache(model_config) # type: ignore[arg-type] - p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type] + p0 = LruKeyReplicatedSenderCache(model_config) + p1 = LruKeyReplicatedReceiverCache(model_config) assert item is not None assert p0.get_and_update_item((item, []), "big")[0] is item assert not p0.is_cached_item("big") @@ -304,8 +304,8 @@ def test_mm_cache_miss_raises_and_recovers(): model or network. """ model_config = _StubModelConfig(mm_processor_cache_gb=1) - p0 = LruKeyReplicatedSenderCache(model_config) # type: ignore[arg-type] - p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type] + p0 = LruKeyReplicatedSenderCache(model_config) + p1 = LruKeyReplicatedReceiverCache(model_config) mm_hash = "image_A" item = MultiModalKwargsItem.dummy(nbytes=64) @@ -348,7 +348,7 @@ def test_receiver_cache_replaces_stale_item_when_payload_resent(): and kills EngineCore. Prefer the fresh payload and keep it for later hits. """ model_config = _StubModelConfig(mm_processor_cache_gb=1) - p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type] + p1 = LruKeyReplicatedReceiverCache(model_config) small = MultiModalKwargsItem.dummy(nbytes=64) large = MultiModalKwargsItem.dummy(nbytes=256) mm_hash = "shared-id" @@ -361,7 +361,7 @@ def test_receiver_cache_replaces_stale_item_when_payload_resent(): def test_receiver_cache_features_keep_resent_payload(): """EngineCore updates features through get_and_update_features.""" model_config = _StubModelConfig(mm_processor_cache_gb=1) - p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type] + p1 = LruKeyReplicatedReceiverCache(model_config) small = MultiModalKwargsItem.dummy(nbytes=64) large = MultiModalKwargsItem.dummy(nbytes=256) mm_hash = "shared-id" @@ -394,7 +394,7 @@ def test_mm_cache_miss_batches_all_drifted_hashes(): non-drifted items in the same request are still ingested. """ model_config = _StubModelConfig(mm_processor_cache_gb=1) - p1 = LruKeyReplicatedReceiverCache(model_config) # type: ignore[arg-type] + p1 = LruKeyReplicatedReceiverCache(model_config) item = MultiModalKwargsItem.dummy(nbytes=64) def _feature( @@ -442,8 +442,8 @@ def test_shm_receiver_handles_prefix_covered_items(monkeypatch): parallel_config=SimpleNamespace(world_size=1), model_config=_StubModelConfig(mm_processor_cache_gb=4 * MiB_bytes / GiB_bytes), ) - p0 = ShmObjectStoreSenderCache(vllm_config) # type: ignore[arg-type] - p1 = ShmObjectStoreReceiverCache(vllm_config, mp.Lock()) # type: ignore[arg-type] + p0 = ShmObjectStoreSenderCache(vllm_config) + p1 = ShmObjectStoreReceiverCache(vllm_config, mp.Lock()) def _feature( mm_hash: str, data: MultiModalKwargsItem | None @@ -1082,9 +1082,9 @@ async def test_release_kv_cache_resends_mm_payload(use_async, release_error): async def call_release(): if use_async: - await AsyncLLM.release_kv_cache_memory(engine) # type: ignore[arg-type] + await AsyncLLM.release_kv_cache_memory(engine) else: - LLMEngine.release_kv_cache_memory(engine) # type: ignore[arg-type] + LLMEngine.release_kv_cache_memory(engine) if release_error: with pytest.raises(RuntimeError, match=release_error): diff --git a/tests/multimodal/test_processing.py b/tests/multimodal/test_processing.py index 63c6080b2d..69d91fd04e 100644 --- a/tests/multimodal/test_processing.py +++ b/tests/multimodal/test_processing.py @@ -1281,7 +1281,7 @@ def test_get_supported_mm_processor_kwargs_uses_supported_modalities( processor: SimpleNamespace, expected: dict[str, set[str]], ) -> None: - info = BaseProcessingInfo(SimpleNamespace()) # type: ignore[arg-type] + info = BaseProcessingInfo(SimpleNamespace()) info.__dict__["supported_mm_limits"] = supported_mm_limits monkeypatch.setattr(info, "get_hf_processor", lambda **_: processor) @@ -1291,7 +1291,7 @@ def test_get_supported_mm_processor_kwargs_uses_supported_modalities( def test_supported_mm_processor_kwargs_is_cached( monkeypatch: pytest.MonkeyPatch, ) -> None: - info = BaseProcessingInfo(SimpleNamespace()) # type: ignore[arg-type] + info = BaseProcessingInfo(SimpleNamespace()) expected = {"images_kwargs": {"size"}} calls = 0 @@ -1442,7 +1442,7 @@ def test_get_merged_mm_kwargs_treats_empty_scopes_as_absent_before_routing( mm_device_do_normalize=False, ) model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config) - ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type] + ctx = InputProcessingContext(model_config, tokenizer=None) merged = ctx.get_merged_mm_kwargs( inference_kwargs, @@ -1482,7 +1482,7 @@ def test_get_merged_mm_kwargs_merges_before_routing(): mm_device_do_normalize=False, ) model_config = SimpleNamespace(get_multimodal_config=lambda: mm_config) - ctx = InputProcessingContext(model_config, tokenizer=None) # type: ignore[arg-type] + ctx = InputProcessingContext(model_config, tokenizer=None) merged = ctx.get_merged_mm_kwargs( { diff --git a/tests/multimodal/test_registry.py b/tests/multimodal/test_registry.py index 1c4e69ba3c..f395d36933 100644 --- a/tests/multimodal/test_registry.py +++ b/tests/multimodal/test_registry.py @@ -24,4 +24,4 @@ def test_create_processor_error_uses_served_model_name(): ValueError, match="friendly-model-name is not a multimodal model", ): - MULTIMODAL_REGISTRY.create_processor(model_config) # type: ignore[arg-type] + MULTIMODAL_REGISTRY.create_processor(model_config) diff --git a/tests/multimodal/test_video.py b/tests/multimodal/test_video.py index 3c0b9db209..2bb77b2ed7 100644 --- a/tests/multimodal/test_video.py +++ b/tests/multimodal/test_video.py @@ -493,7 +493,7 @@ def test_pynvvideocodec_failed_rebuild_invalidates_decoder_slot(): old_decoder = FakeDecoder() slot = PyNvVideoCodecDecoderSlot(FakeStream()) - slot.decoder = old_decoder # type: ignore[assignment] # Fake retained GPU decoder. + slot.decoder = old_decoder slot.source_path = "valid.mp4" class FakeNvc: diff --git a/tests/parser/cohere/test_structural_tags.py b/tests/parser/cohere/test_structural_tags.py index 5083215d3b..893cfc80f7 100644 --- a/tests/parser/cohere/test_structural_tags.py +++ b/tests/parser/cohere/test_structural_tags.py @@ -347,7 +347,7 @@ class TestAdjustRequestFoldFromStructuredOutputs: id="chat_completion_request", ), pytest.param( - lambda: StructuredOutputsParams(json=[1, 2, 3]), # type: ignore[arg-type] + lambda: StructuredOutputsParams(json=[1, 2, 3]), id="structured_outputs_params", ), ], diff --git a/tests/plugins_tests/bitsandbytes/test_bitsandbytes.py b/tests/plugins_tests/bitsandbytes/test_bitsandbytes.py index 1e96598d4d..f5845efb04 100644 --- a/tests/plugins_tests/bitsandbytes/test_bitsandbytes.py +++ b/tests/plugins_tests/bitsandbytes/test_bitsandbytes.py @@ -271,7 +271,7 @@ def test_bitsandbytes_passes_revision_by_name(): return_value=["/folder/model.safetensors"], ), ): - bnb.BitsAndBytesModelLoader._prepare_weights(fake_self, "org/model", "myrev") # type: ignore[arg-type] + bnb.BitsAndBytesModelLoader._prepare_weights(fake_self, "org/model", "myrev") mock_idx.assert_called_once() assert mock_idx.call_args.kwargs.get("revision") == "myrev" diff --git a/tests/plugins_tests/bitsandbytes/test_transformers.py b/tests/plugins_tests/bitsandbytes/test_transformers.py index 398d869ade..1d50f69a07 100644 --- a/tests/plugins_tests/bitsandbytes/test_transformers.py +++ b/tests/plugins_tests/bitsandbytes/test_transformers.py @@ -43,7 +43,7 @@ def test_transformers_backend_quantization( model, model_impl="auto", enforce_eager=True, - **quantization_kwargs, # type: ignore[arg-type] + **quantization_kwargs, ) as vllm_model: vllm_outputs = vllm_model.generate_greedy_logprobs( example_prompts, max_tokens=max_tokens, num_logprobs=num_logprobs @@ -53,7 +53,7 @@ def test_transformers_backend_quantization( model, model_impl="transformers", enforce_eager=True, - **quantization_kwargs, # type: ignore[arg-type] + **quantization_kwargs, ) as vllm_model: model_config = vllm_model.llm.llm_engine.model_config assert model_config.using_transformers_backend() diff --git a/tests/plugins_tests/gguf/test_gguf_plugin_multimodal.py b/tests/plugins_tests/gguf/test_gguf_plugin_multimodal.py index 5ebd7d36e8..56930a7d0b 100644 --- a/tests/plugins_tests/gguf/test_gguf_plugin_multimodal.py +++ b/tests/plugins_tests/gguf/test_gguf_plugin_multimodal.py @@ -92,7 +92,7 @@ def run_multimodal_gguf_test( num_logprobs: int, ): # Load images at runtime (inside subprocess) to avoid pickle issues - images = [ImageAsset(name).pil_image for name in model.image_names] # type: ignore[arg-type] + images = [ImageAsset(name).pil_image for name in model.image_names] size_factors = [0.25, 0.5, 1.0] inputs_per_image = [ ( diff --git a/tests/plugins_tests/test_endpoint_plugins.py b/tests/plugins_tests/test_endpoint_plugins.py index 51d96643d9..2d92153900 100644 --- a/tests/plugins_tests/test_endpoint_plugins.py +++ b/tests/plugins_tests/test_endpoint_plugins.py @@ -172,7 +172,7 @@ async def test_init_state_is_noop_without_phase_a(monkeypatch: pytest.MonkeyPatc monkeypatch.setenv("VLLM_PLUGINS", "dummy_admin_endpoint_plugin") state = State() - await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args()) # type: ignore[arg-type] + await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args()) assert not hasattr(state, "dummy_engine_client") @@ -223,7 +223,7 @@ async def test_endpoint_plugin_end_to_end(monkeypatch: pytest.MonkeyPatch): ) fake_engine_client = _FakeEngineClient(rpc_result=["cfg-a", "cfg-b"]) - await init_endpoint_plugins_state(fake_engine_client, app.state, args) # type: ignore[arg-type] + await init_endpoint_plugins_state(fake_engine_client, app.state, args) assert app.state.dummy_engine_client is fake_engine_client diff --git a/tests/plugins_tests/test_oot_registration_offline.py b/tests/plugins_tests/test_oot_registration_offline.py index 4fac55f82d..ac5361c66f 100644 --- a/tests/plugins_tests/test_oot_registration_offline.py +++ b/tests/plugins_tests/test_oot_registration_offline.py @@ -92,7 +92,7 @@ def test_oot_registration_multimodal( ) first_token = llm.get_tokenizer().decode(0) - outputs = llm.generate(prompts, sampling_params) # type: ignore[arg-type] + outputs = llm.generate(prompts, sampling_params) for output in outputs: generated_text = output.outputs[0].text diff --git a/tests/plugins_tests/test_stats_logger_plugins.py b/tests/plugins_tests/test_stats_logger_plugins.py index 518015f76a..2f4d0ec694 100644 --- a/tests/plugins_tests/test_stats_logger_plugins.py +++ b/tests/plugins_tests/test_stats_logger_plugins.py @@ -24,7 +24,7 @@ def test_stat_logger_plugin_is_discovered(monkeypatch: pytest.MonkeyPatch): vllm_config = VllmConfig() instance = factories[0](vllm_config) # The `is` check above narrows DummyStatLogger to a Callable - assert isinstance(instance, DummyStatLogger) # type: ignore[arg-type] + assert isinstance(instance, DummyStatLogger) def test_no_plugins_loaded_if_env_empty(monkeypatch: pytest.MonkeyPatch): diff --git a/tests/quantization/test_auto_gptq.py b/tests/quantization/test_auto_gptq.py index fbf405210a..6e7791654c 100644 --- a/tests/quantization/test_auto_gptq.py +++ b/tests/quantization/test_auto_gptq.py @@ -123,8 +123,8 @@ def test_auto_gptq_moe_creates_zero_initialized_expert_biases(): method = object.__new__(AutoGPTQMoEMethod) method.quant_config = AutoGPTQConfig(4, 128, False, True, False, {}, {}) method.input_dtype = None - method.experts_cls = None # type: ignore[assignment] # Weight creation does not select experts. - method.moe = SimpleNamespace(w13_num_shards=2) # type: ignore[assignment] + method.experts_cls = None + method.moe = SimpleNamespace(w13_num_shards=2) layer = torch.nn.Module() method.create_weights( diff --git a/tests/quantization/test_auto_round.py b/tests/quantization/test_auto_round.py index dc09805610..eb8273c6d6 100644 --- a/tests/quantization/test_auto_round.py +++ b/tests/quantization/test_auto_round.py @@ -423,7 +423,7 @@ def test_inc_get_quant_method_unquantized_routed_experts_with_model_prefix( config = make_config(extra_config={"model.moe_layer": {"bits": 16}}) layer = object.__new__(RoutedExperts) - layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub. + layer.moe_config = None method = config.get_quant_method(layer, "moe_layer") @@ -730,7 +730,7 @@ def test_wna16_cuda_low_bit_moe_routes_to_humming(monkeypatch, bits) -> None: ) layer = object.__new__(RoutedExperts) - layer.moe_config = DummyMoeConfig() # type: ignore[assignment] + layer.moe_config = DummyMoeConfig() layer_config = make_layer_config(bits=bits) method = INCWna16Scheme().get_moe_method( make_config(), layer, "model.layers.0.mlp", layer_config @@ -861,7 +861,7 @@ def test_qwen3_30b_a3b_w4a16_autoround_routes_to_gptq_moe( config = make_qwen3_autoround_config("qwen3_30b_a3b_w4a16") layer = object.__new__(RoutedExperts) - layer.moe_config = DummyMoeConfig() # type: ignore[assignment] + layer.moe_config = DummyMoeConfig() method = config.get_quant_method(layer, "model.layers.0.mlp") @@ -890,7 +890,7 @@ def test_qwen3_30b_a3b_mxfp4_autoround_routes_to_mxfp4_moe( config = make_qwen3_autoround_config("qwen3_30b_a3b_mxfp4") layer = object.__new__(RoutedExperts) - layer.moe_config = DummyMoeConfig() # type: ignore[assignment] + layer.moe_config = DummyMoeConfig() ignored_method = config.get_quant_method( 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: ) layer = object.__new__(RoutedExperts) - layer.moe_config = DummyMoeConfig() # type: ignore[assignment] + layer.moe_config = DummyMoeConfig() method = INCWna16Scheme().get_moe_method( make_config(), layer, @@ -1669,7 +1669,7 @@ def test_inc_get_quant_method_unquantized_moe_returns_unquantized( when extra_config has bits >= 16.""" config = make_config(extra_config={"layer": {"bits": 16}}) layer = object.__new__(RoutedExperts) - layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub. + layer.moe_config = None class DummyUnquantizedFusedMoEMethod: def __init__(self, moe_config) -> None: diff --git a/tests/quantization/test_fp8.py b/tests/quantization/test_fp8.py index f880064e37..1cb53f2239 100644 --- a/tests/quantization/test_fp8.py +++ b/tests/quantization/test_fp8.py @@ -220,7 +220,7 @@ def test_deepseek_v41_vl_mapper_routes_linear_scales( quant_config=SimpleNamespace(weight_block_size=weight_block_size) ) resolved = model_module._linear_scale_param_name( - vllm_config, # type: ignore[arg-type] + vllm_config, expert_dtype, ) assert resolved == scale_name @@ -798,7 +798,7 @@ def test_kv_cache_scale_sync_to_host_copies(): set_default_quant_scales(layer, register_buffer=True) layer.kv_cache_dtype = "fp8" - method = BaseKVCacheMethod(quant_config=None) # type: ignore[arg-type] # Scale synchronization does not use quant_config. + method = BaseKVCacheMethod(quant_config=None) method.create_weights(layer) # 0.3 stays != 1.0 even after the fp8_fnuz x2 rescale. checkpoint_scale = torch.tensor(0.3, dtype=torch.float32) diff --git a/tests/quantization/test_moe_wna16.py b/tests/quantization/test_moe_wna16.py index abbcb86916..c295a195a5 100644 --- a/tests/quantization/test_moe_wna16.py +++ b/tests/quantization/test_moe_wna16.py @@ -218,9 +218,9 @@ def test_gptq_nfirst_weights_pass_through_for_triton(): def test_moe_wna16_setup_forwards_selected_backend(monkeypatch): method = object.__new__(MoeWNA16Method) - method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel. + method.experts_cls = object method.wna16_backend = WNA16MoEBackend.HUMMING - method.moe = object() # type: ignore[assignment] # Opaque mocked-config sentinel. + method.moe = object() quant_config = object() monkeypatch.setattr( method, "get_fused_moe_quant_config", lambda layer: quant_config @@ -235,7 +235,7 @@ def test_moe_wna16_setup_forwards_selected_backend(monkeypatch): monkeypatch.setattr(moe_wna16, "make_wna16_moe_kernel", fake_make_wna16_moe_kernel) - method._setup_kernel(layer) # type: ignore[arg-type] # Routing-table stub. + method._setup_kernel(layer) assert method.moe_kernel is kernel assert captured["backend"] == WNA16MoEBackend.HUMMING @@ -280,7 +280,7 @@ def test_moe_wna16_uses_humming_quant_config(monkeypatch): ), ) - assert method.get_fused_moe_quant_config(layer) is quant_config # type: ignore[arg-type] # Identity sentinel. + assert method.get_fused_moe_quant_config(layer) is quant_config @pytest.mark.skipif( diff --git a/tests/quantization/test_online.py b/tests/quantization/test_online.py index c8a75bf1f0..b4dffbb375 100644 --- a/tests/quantization/test_online.py +++ b/tests/quantization/test_online.py @@ -210,9 +210,9 @@ def test_online_nvfp4_reuses_kernel_when_weights_are_reprocessed( monkeypatch, ) -> None: method = object.__new__(Nvfp4OnlineMoEMethod) - method.moe = SimpleNamespace(is_act_and_mul=True) # type: ignore[assignment] - method.nvfp4_backend = object() # type: ignore[assignment] # Opaque mocked-backend sentinel. - method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel. + method.moe = SimpleNamespace(is_act_and_mul=True) + method.nvfp4_backend = object() + method.experts_cls = object method.moe_quant_config = None method.moe_kernel = None @@ -1432,7 +1432,7 @@ def test_online_int8_moe_w2_scale_matches_unsharded(monkeypatch) -> None: layer.w2_weight = torch.nn.Parameter(w2_in, requires_grad=False) layer.num_experts = layer.local_num_experts = w13.shape[0] method = SimpleNamespace(moe=SimpleNamespace(tp_size=moe_tp_size)) - Int8OnlineMoEMethod._quantize_weights(method, layer) # type: ignore[arg-type] + Int8OnlineMoEMethod._quantize_weights(method, layer) return layer.w2_weight, layer.w2_scale full_weight, full_scale = quantize(w2, 1) diff --git a/tests/quantization/test_quark.py b/tests/quantization/test_quark.py index 097f03bb00..9ec0bb78d2 100644 --- a/tests/quantization/test_quark.py +++ b/tests/quantization/test_quark.py @@ -2314,7 +2314,7 @@ class TestQuarkInt4Format: None, quant_config.quant_config["global_quant_config"]["weight"], quant_config.pack_method, - moe_config, # type: ignore[arg-type] + moe_config, ) layer = _FakeLayer(moe_config) @@ -2326,7 +2326,7 @@ class TestQuarkInt4Format: requires_grad=False, ) loader = method.get_weight_loader( - layer, # type: ignore[arg-type] + layer, weight_loader=None, ) loader( diff --git a/tests/quantization/test_trtllm_nvfp4_hidden_dim_padding.py b/tests/quantization/test_trtllm_nvfp4_hidden_dim_padding.py index 48d7f13aef..9effb4f7fc 100644 --- a/tests/quantization/test_trtllm_nvfp4_hidden_dim_padding.py +++ b/tests/quantization/test_trtllm_nvfp4_hidden_dim_padding.py @@ -34,7 +34,7 @@ def test_shared_nvfp4_input_scales_have_writable_storage(monkeypatch): outputs = prepare_nvfp4_moe_layer_for_fi_or_cutlass( backend=NvFp4MoeBackend.FLASHINFER_CUTLASS, - layer=layer, # type: ignore[arg-type] + layer=layer, w13=w13, w13_scale=w13_scale, w13_scale_2=weight_scale, diff --git a/tests/quantization/test_turboquant.py b/tests/quantization/test_turboquant.py index e60f763c2c..9f6beb3eb8 100644 --- a/tests/quantization/test_turboquant.py +++ b/tests/quantization/test_turboquant.py @@ -300,7 +300,7 @@ class TestTurboQuantKVCacheSpec: # The layer builds an unpacked spec; the worker's spec-collection # loop applies TQ slot packing via the backend's customize_spec hook. - spec = Attention.get_kv_cache_spec(layer, vllm_config) # type: ignore[arg-type] + spec = Attention.get_kv_cache_spec(layer, vllm_config) assert isinstance(spec, FullAttentionSpec) assert spec.kv_quant_mode.is_turboquant assert spec.state_content_bytes is None diff --git a/tests/reasoning/test_base_thinking_reasoning_parser.py b/tests/reasoning/test_base_thinking_reasoning_parser.py index 14792b210b..fad9949881 100644 --- a/tests/reasoning/test_base_thinking_reasoning_parser.py +++ b/tests/reasoning/test_base_thinking_reasoning_parser.py @@ -68,7 +68,7 @@ class TestBaseThinkingReasoningParserInit: def test_initialization_with_missing_tokenizer(self): """Test that initialization fails without tokenizer.""" with pytest.raises(ValueError, match="model tokenizer must be passed"): - TestThinkingReasoningParser(None) # type: ignore[arg-type] + TestThinkingReasoningParser(None) def test_initialization_with_missing_tokens(self, test_tokenizer): """Test that initialization fails when tokens are not in vocabulary.""" diff --git a/tests/renderers/test_cohere.py b/tests/renderers/test_cohere.py index ae2dfe6c7a..4f6e3685e7 100644 --- a/tests/renderers/test_cohere.py +++ b/tests/renderers/test_cohere.py @@ -81,7 +81,7 @@ class TestRoleToMelody: # reject non-strings — any exception type is acceptable as long # as we don't silently produce a malformed prompt. with pytest.raises((AttributeError, TypeError, ValueError)): - _role_to_melody(None) # type: ignore[arg-type] + _role_to_melody(None) # ====================================================================== @@ -135,7 +135,7 @@ class TestNormalizeToolCall: def test_invalid_type_rejected(self): with pytest.raises(TypeError, match="Unexpected tool_call value"): - _normalize_tool_call(42) # type: ignore[arg-type] + _normalize_tool_call(42) # ====================================================================== @@ -249,7 +249,7 @@ class TestDocumentToMelody: def test_invalid_type_rejected(self): with pytest.raises(TypeError, match="Unsupported document type"): - _document_to_melody(42) # type: ignore[arg-type] + _document_to_melody(42) # ====================================================================== @@ -302,7 +302,7 @@ class TestToolToMelody: def test_invalid_type_rejected(self): with pytest.raises(TypeError, match="Unsupported tool type"): - _tool_to_melody(42) # type: ignore[arg-type] + _tool_to_melody(42) # ====================================================================== @@ -418,7 +418,7 @@ class TestConversationToMelody: {"role": "user", "content": "hi"}, {"role": "assistant", "content": "hello"}, ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out == [ { "role": "user", @@ -443,7 +443,7 @@ class TestConversationToMelody: "reasoning": "thoughts", } ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out[0]["content"] == [ {"type": MelodyContentType.THINKING, "thinking": "thoughts"}, {"type": MelodyContentType.TEXT, "text": "answer"}, @@ -457,7 +457,7 @@ class TestConversationToMelody: "reasoning_content": "thoughts", } ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out[0]["content"][0] == { "type": MelodyContentType.THINKING, "thinking": "thoughts", @@ -474,7 +474,7 @@ class TestConversationToMelody: "reasoning": "should be ignored", } ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out[0]["content"] == [{"type": MelodyContentType.TEXT, "text": "hi"}] def test_tool_calls_normalized(self): @@ -491,7 +491,7 @@ class TestConversationToMelody: ], } ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out[0]["tool_calls"] == [ {"id": "c1", "name": "f", "parameters": '{"a":1}'} ] @@ -504,7 +504,7 @@ class TestConversationToMelody: "tool_call_id": "c1", } ] - out = _conversation_to_melody_messages(conv) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv) assert out[0]["tool_call_id"] == "c1" def test_messages_citations_attached_by_index(self): @@ -531,20 +531,20 @@ class TestConversationToMelody: } ] } - out = _conversation_to_melody_messages(conv, citations) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv, citations) assert "citations" not in out[0] assert out[1]["citations"] == citations[1] def test_messages_citations_none_is_a_no_op(self): conv = [{"role": "assistant", "content": "a"}] - out = _conversation_to_melody_messages(conv, None) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv, None) assert "citations" not in out[0] def test_messages_citations_missing_index_is_a_no_op(self): # A ``messages_citations`` dict whose key doesn't hit any # message must not attach anything (and must not raise). conv = [{"role": "assistant", "content": "a"}] - out = _conversation_to_melody_messages(conv, {5: [{"anything": 1}]}) # type: ignore[arg-type] + out = _conversation_to_melody_messages(conv, {5: [{"anything": 1}]}) assert "citations" not in out[0] def test_tool_message_v2_content_replaces_default_content(self): @@ -575,7 +575,7 @@ class TestConversationToMelody: ] } out = _conversation_to_melody_messages( - conv, # type: ignore[arg-type] + conv, tool_message_v2_content=v2_content, ) # User message (no forwarded entry) still goes through the @@ -597,7 +597,7 @@ class TestConversationToMelody: ] } out = _conversation_to_melody_messages( - conv, # type: ignore[arg-type] + conv, tool_message_v2_content=v2_content, ) assert out[0]["content"] == [ @@ -607,7 +607,7 @@ class TestConversationToMelody: def test_tool_message_v2_content_none_falls_back_to_default(self): conv = [{"role": "tool", "tool_call_id": "c", "content": "plain text"}] out = _conversation_to_melody_messages( - conv, # type: ignore[arg-type] + conv, tool_message_v2_content=None, ) assert out[0]["content"] == [{"type": "text", "text": "plain text"}] @@ -626,7 +626,7 @@ class TestBuildRenderConfig: # Bare kwargs -> cmd4 (the current Command A+ prompt format). # Mirrors ``_DEFAULT_FORMAT`` in ``vllm/renderers/cohere.py`` and # the ``--cohere-format`` CLI default. - fmt, cfg = _build_render_config(self._conv(), {}) # type: ignore[arg-type] + fmt, cfg = _build_render_config(self._conv(), {}) assert fmt == "cmd4" assert cfg["use_jinja"] is True assert isinstance(cfg["messages"], list) @@ -634,12 +634,12 @@ class TestBuildRenderConfig: assert "additional_template_fields" not in cfg def test_explicit_cmd3(self): - fmt, cfg = _build_render_config(self._conv(), {"cohere_format": "cmd3"}) # type: ignore[arg-type] + fmt, cfg = _build_render_config(self._conv(), {"cohere_format": "cmd3"}) assert fmt == "cmd3" def test_invalid_format_raises(self): with pytest.raises(ValueError, match="Invalid cohere_format"): - _build_render_config(self._conv(), {"cohere_format": "cmd5"}) # type: ignore[arg-type] + _build_render_config(self._conv(), {"cohere_format": "cmd5"}) def test_documents_converted(self): _, cfg = _build_render_config( @@ -650,7 +650,7 @@ class TestBuildRenderConfig: {"id": "d1", "data": {"text": "wrapped"}}, ] }, - ) # type: ignore[arg-type] + ) assert cfg["documents"] == [ {"text": "doc text"}, {"id": "d1", "text": "wrapped"}, @@ -665,7 +665,7 @@ class TestBuildRenderConfig: {"type": "function", "function": {"name": "preferred"}} ], }, - ) # type: ignore[arg-type] + ) names = [t["name"] for t in cfg["available_tools"]] assert names == ["preferred"] @@ -673,30 +673,30 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"tools": [{"type": "function", "function": {"name": "from_tools"}}]}, - ) # type: ignore[arg-type] + ) assert [t["name"] for t in cfg["available_tools"]] == ["from_tools"] @pytest.mark.parametrize("value", ["enabled", "disabled"]) def test_reasoning_type_direct(self, value): - _, cfg = _build_render_config(self._conv(), {"reasoning_type": value}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"reasoning_type": value}) assert cfg["reasoning_type"] == value def test_thinking_dict_shorthand_resolves_reasoning_type(self): - _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "enabled"}}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "enabled"}}) assert cfg["reasoning_type"] == "enabled" def test_thinking_shorthand_ignores_unknown_type(self): - _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "auto"}}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"thinking": {"type": "auto"}}) assert "reasoning_type" not in cfg def test_dev_instruction_forwarded(self): - _, cfg = _build_render_config(self._conv(), {"dev_instruction": "be brief"}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"dev_instruction": "be brief"}) assert cfg["dev_instruction"] == "be brief" def test_response_format_json_object_sets_json_mode(self): _, cfg = _build_render_config( self._conv(), {"response_format": {"type": "json_object"}} - ) # type: ignore[arg-type] + ) assert cfg["json_mode"] is True assert "json_schema" not in cfg @@ -705,7 +705,7 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"response_format": {"type": "json_schema", "schema": schema}}, - ) # type: ignore[arg-type] + ) # JSON-encoded for melody (string-only schema field). assert cfg["json_schema"] == json.dumps(schema) @@ -721,35 +721,35 @@ class TestBuildRenderConfig: "schema": {"schema": inner}, } }, - ) # type: ignore[arg-type] + ) assert cfg["json_schema"] == json.dumps(inner) def test_json_schema_kwarg_direct(self): # Caller can also pass ``json_schema`` directly, both as dict and # as a pre-stringified value. - _, cfg = _build_render_config(self._conv(), {"json_schema": {"a": 1}}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"json_schema": {"a": 1}}) assert cfg["json_schema"] == '{"a": 1}' _, cfg = _build_render_config( self._conv(), {"json_schema": "raw-string-schema"} - ) # type: ignore[arg-type] + ) assert cfg["json_schema"] == "raw-string-schema" def test_json_mode_kwarg_overrides(self): - _, cfg = _build_render_config(self._conv(), {"json_mode": True}) # type: ignore[arg-type] + _, cfg = _build_render_config(self._conv(), {"json_mode": True}) assert cfg["json_mode"] is True def test_cmd3_safety_mode_lowercased(self): _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "safety_mode": "CONTEXTUAL"}, - ) # type: ignore[arg-type] + ) assert cfg["safety_mode"] == "contextual" def test_cmd3_citation_quality_direct(self): _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "citation_quality": "ACCURATE"}, - ) # type: ignore[arg-type] + ) assert cfg["citation_quality"] == "accurate" def test_cmd3_citation_quality_derived_from_citation_options(self): @@ -758,20 +758,20 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "citation_options": {"mode": "accurate"}}, - ) # type: ignore[arg-type] + ) assert cfg["citation_quality"] == "on" _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "citation_options": {"mode": "off"}}, - ) # type: ignore[arg-type] + ) assert cfg["citation_quality"] == "off" def test_cmd3_skip_preamble_forwarded(self): _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "skip_preamble": True}, - ) # type: ignore[arg-type] + ) assert cfg["skip_preamble"] is True def test_cmd3_no_grounding_field(self): @@ -779,7 +779,7 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd3", "grounding": "fast"}, - ) # type: ignore[arg-type] + ) assert "grounding" not in cfg @pytest.mark.parametrize( @@ -800,7 +800,7 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"cohere_format": "cmd4", "grounding": raw}, - ) # type: ignore[arg-type] + ) assert cfg["grounding"] == expected @pytest.mark.parametrize( @@ -818,7 +818,7 @@ class TestBuildRenderConfig: "cohere_format": "cmd4", "citation_options": {"mode": mode}, }, - ) # type: ignore[arg-type] + ) assert cfg["grounding"] == expected def test_cmd4_grounding_rejects_unknown_value(self): @@ -826,7 +826,7 @@ class TestBuildRenderConfig: _build_render_config( self._conv(), {"cohere_format": "cmd4", "grounding": "foobar"}, - ) # type: ignore[arg-type] + ) def test_cmd4_platform_instruction(self): _, cfg = _build_render_config( @@ -835,7 +835,7 @@ class TestBuildRenderConfig: "cohere_format": "cmd4", "platform_instruction": "do this", }, - ) # type: ignore[arg-type] + ) assert cfg["platform_instruction"] == "do this" def test_cmd4_no_safety_mode_field(self): @@ -847,7 +847,7 @@ class TestBuildRenderConfig: "safety_mode": "contextual", "citation_quality": "on", }, - ) # type: ignore[arg-type] + ) assert "safety_mode" not in cfg assert "citation_quality" not in cfg @@ -862,7 +862,7 @@ class TestBuildRenderConfig: "my_var": "x", "documents": ["doc"], # consumed, must NOT leak through }, - ) # type: ignore[arg-type] + ) extras = cfg["additional_template_fields"] assert extras == {"reasoning_effort": "low", "my_var": "x"} # Sanity: the consumed key still produced its dedicated config slot. @@ -875,7 +875,7 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {"template_id": "tpl1"}, - ) # type: ignore[arg-type] + ) assert cfg["template_id"] == "tpl1" # use_jinja is always True, regardless of caller input. assert cfg["use_jinja"] is True @@ -896,7 +896,7 @@ class TestBuildRenderConfig: _build_render_config( self._conv(), {cohere_only_key: "raw {{ jinja }}"}, - ) # type: ignore[arg-type] + ) @pytest.mark.parametrize("cohere_only_key", ["template_jinja", "template"]) def test_cohere_only_template_kwargs_none_is_tolerated(self, cohere_only_key): @@ -906,7 +906,7 @@ class TestBuildRenderConfig: _, cfg = _build_render_config( self._conv(), {cohere_only_key: None}, - ) # type: ignore[arg-type] + ) assert cohere_only_key not in cfg assert "additional_template_fields" not in cfg @@ -918,7 +918,7 @@ class TestBuildRenderConfig: self._conv(), {}, "raw {{ jinja }}", - ) # type: ignore[arg-type] + ) assert cfg["template_jinja"] == "raw {{ jinja }}" assert cfg["use_jinja"] is True @@ -927,7 +927,7 @@ class TestBuildRenderConfig: self._conv(), {}, None, - ) # type: ignore[arg-type] + ) assert "template_jinja" not in cfg def test_tool_message_v2_content_key_picked_up_from_kwargs(self): @@ -954,7 +954,7 @@ class TestBuildRenderConfig: ] } } - _, cfg = _build_render_config(conv, kwargs) # type: ignore[arg-type] + _, cfg = _build_render_config(conv, kwargs) tool_msg = cfg["messages"][1] assert tool_msg["content"] == [{"type": "document", "document": {"r": "k"}}] # And the key must be *consumed* -- not surfaced as a stray diff --git a/tests/renderers/test_completions.py b/tests/renderers/test_completions.py index 99862219b9..0dce7ef684 100644 --- a/tests/renderers/test_completions.py +++ b/tests/renderers/test_completions.py @@ -139,7 +139,7 @@ class TestValidatePrompt: with pytest.raises(TypeError, match="should be a list of integers"): renderer.render_prompts( - _preprocess_prompt(renderer.model_config, [[1, 2], ["foo", "bar"]]) # type: ignore[arg-type] + _preprocess_prompt(renderer.model_config, [[1, 2], ["foo", "bar"]]) ) diff --git a/tests/samplers/test_beam_search.py b/tests/samplers/test_beam_search.py index daf6f4386c..823202ba32 100644 --- a/tests/samplers/test_beam_search.py +++ b/tests/samplers/test_beam_search.py @@ -113,7 +113,7 @@ def test_beam_search_abort_returns_partial_outputs_and_continues_other_prompts( {"type": "token", "prompt_token_ids": [token]} for token in [prompt_token, 2] ] params = BeamSearchParams(beam_width=2, max_tokens=3) - outputs = llm.beam_search(prompts, params) # type: ignore[arg-type] + outputs = llm.beam_search(prompts, params) aborted, normal = outputs expected_tokens = ( @@ -326,7 +326,7 @@ def test_beam_search_structured_output( llm = LLM( model=model, - dtype=dtype, # type: ignore[arg-type] + dtype=dtype, max_model_len=512, structured_outputs_config=dict( backend="xgrammar", @@ -345,7 +345,7 @@ def test_beam_search_structured_output( "Generate a JSON object for a person with name and age:", ] - outputs = llm.beam_search(prompts, params) # type: ignore[arg-type] + outputs = llm.beam_search(prompts, params) assert len(outputs) == len(prompts) for output in outputs: diff --git a/tests/samplers/test_beam_search_online.py b/tests/samplers/test_beam_search_online.py index 4c48c6189d..cbed58363a 100644 --- a/tests/samplers/test_beam_search_online.py +++ b/tests/samplers/test_beam_search_online.py @@ -57,8 +57,8 @@ class _EngineClient: class _Serving(BeamSearchOnlineMixin): - renderer = _Renderer() # type: ignore[assignment] - engine_client = _EngineClient() # type: ignore[assignment] + renderer = _Renderer() + engine_client = _EngineClient() @pytest.mark.asyncio diff --git a/tests/standalone_tests/lazy_imports.py b/tests/standalone_tests/lazy_imports.py index fff5c54f27..963b19e211 100644 --- a/tests/standalone_tests/lazy_imports.py +++ b/tests/standalone_tests/lazy_imports.py @@ -17,6 +17,6 @@ module_names = ["torch._inductor.async_compile", "cv2"] # if we import any modules during `import vllm`, there would be a # hard error and nice stacktrace on the first import. for module_name in module_names: - sys.modules[module_name] = None # type: ignore[assignment] + sys.modules[module_name] = None import vllm # noqa diff --git a/tests/test_audio_media_size_precheck.py b/tests/test_audio_media_size_precheck.py index e1f2ed8df4..7635022369 100644 --- a/tests/test_audio_media_size_precheck.py +++ b/tests/test_audio_media_size_precheck.py @@ -144,6 +144,6 @@ async def test_audio_connector_threads_byte_limit_to_http_reader( assert kwargs["max_bytes"] == MiB_bytes raise VLLMValidationError("Maximum file size exceeded") - connector = MediaConnector(connection=_Connection()) # type: ignore[arg-type] + connector = MediaConnector(connection=_Connection()) with pytest.raises(VLLMValidationError, match="Maximum file size exceeded"): await connector.fetch_audio_async("https://example.test/audio") diff --git a/tests/tokenizers_/test_mistral.py b/tests/tokenizers_/test_mistral.py index 5229eaaf9c..24bd8e00f1 100644 --- a/tests/tokenizers_/test_mistral.py +++ b/tests/tokenizers_/test_mistral.py @@ -975,7 +975,7 @@ class TestMistralTokenizer: mistral_tokenizer: MistralTokenizer, ): assert mistral_tokenizer.batch_decode( - [[]], # type: ignore[arg-type] + [[]], ) == [""] def test_convert_tokens_to_string(self, mistral_tokenizer: MistralTokenizer): @@ -2246,7 +2246,7 @@ class TestMistralTokenizer: ] output = mistral_tokenizer.apply_chat_template( - messages, # type: ignore[arg-type] + messages, add_generation_prompt=True, ) decoded = mistral_tokenizer.tokenizer.decode(output, SpecialTokenPolicy.KEEP) @@ -2352,7 +2352,7 @@ def test_v15_apply_chat_template_passes_reasoning_effort_high( ) v15_mistral_tokenizer.apply_chat_template( - messages=_PASSTHROUGH_MESSAGES, # type: ignore[arg-type] + messages=_PASSTHROUGH_MESSAGES, reasoning_effort="high", ) @@ -2375,7 +2375,7 @@ def test_v15_apply_chat_template_passes_reasoning_effort_none_by_default( fake_apply_chat_template, ) - v15_mistral_tokenizer.apply_chat_template(messages=_PASSTHROUGH_MESSAGES) # type: ignore[arg-type] + v15_mistral_tokenizer.apply_chat_template(messages=_PASSTHROUGH_MESSAGES) assert "reasoning_effort" in captured_kwargs[-1] assert captured_kwargs[-1]["reasoning_effort"] is None @@ -2398,7 +2398,7 @@ def test_pre_v15_apply_chat_template_omits_reasoning_effort( ) v13_mistral_tokenizer.apply_chat_template( - messages=_PASSTHROUGH_MESSAGES, # type: ignore[arg-type] + messages=_PASSTHROUGH_MESSAGES, reasoning_effort="high", ) diff --git a/tests/tokenizers_/test_registry.py b/tests/tokenizers_/test_registry.py index e1da601b64..a4ee4a755e 100644 --- a/tests/tokenizers_/test_registry.py +++ b/tests/tokenizers_/test_registry.py @@ -205,7 +205,7 @@ def test_cached_tokenizer_from_config_registers_local_config(tmp_path: Path): side_effect=lambda tokenizer: tokenizer, ), ): - tokenizer = cached_tokenizer_from_config(model_config) # type: ignore[arg-type] + tokenizer = cached_tokenizer_from_config(model_config) assert tokenizer.is_fast is True finally: diff --git a/tests/tool_parsers/test_ernie45_moe_tool_parser.py b/tests/tool_parsers/test_ernie45_moe_tool_parser.py index b6f536ca74..8ad2cdfc33 100644 --- a/tests/tool_parsers/test_ernie45_moe_tool_parser.py +++ b/tests/tool_parsers/test_ernie45_moe_tool_parser.py @@ -54,7 +54,7 @@ def test_extract_tool_calls_no_tools(ernie45_tool_parser): model_output = "This is a test" extracted_tool_calls = ernie45_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert not extracted_tool_calls.tools_called assert extracted_tool_calls.tool_calls == [] assert extracted_tool_calls.content == model_output @@ -163,7 +163,7 @@ def test_extract_tool_calls( ): extracted_tool_calls = ernie45_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert extracted_tool_calls.tools_called assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls) diff --git a/tests/tool_parsers/test_jamba_tool_parser.py b/tests/tool_parsers/test_jamba_tool_parser.py index 33f44fe838..54c6cd747d 100644 --- a/tests/tool_parsers/test_jamba_tool_parser.py +++ b/tests/tool_parsers/test_jamba_tool_parser.py @@ -78,7 +78,7 @@ def stream_delta_message_generator( previous_token_ids, current_token_ids, delta_token_ids, - request=None, # type: ignore[arg-type] + request=None, ) if delta_message: yield delta_message @@ -95,7 +95,7 @@ def test_extract_tool_calls_no_tools(jamba_tool_parser): model_output = "This is a test" extracted_tool_calls = jamba_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert not extracted_tool_calls.tools_called assert extracted_tool_calls.tool_calls == [] assert extracted_tool_calls.content == model_output @@ -166,7 +166,7 @@ def test_extract_tool_calls( ): extracted_tool_calls = jamba_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert extracted_tool_calls.tools_called assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls) diff --git a/tests/tool_parsers/test_qwen3coder_tool_parser.py b/tests/tool_parsers/test_qwen3coder_tool_parser.py index c397d0ffad..45212704d0 100644 --- a/tests/tool_parsers/test_qwen3coder_tool_parser.py +++ b/tests/tool_parsers/test_qwen3coder_tool_parser.py @@ -225,7 +225,7 @@ def test_extract_tool_calls_no_tools(qwen3_tool_parser): model_output = "This is a test response without any tool calls" extracted_tool_calls = qwen3_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert not extracted_tool_calls.tools_called assert extracted_tool_calls.tool_calls == [] assert extracted_tool_calls.content == model_output diff --git a/tests/tool_parsers/test_step3p5_tool_parser.py b/tests/tool_parsers/test_step3p5_tool_parser.py index 0dbe114545..8291c62319 100644 --- a/tests/tool_parsers/test_step3p5_tool_parser.py +++ b/tests/tool_parsers/test_step3p5_tool_parser.py @@ -170,7 +170,7 @@ def test_extract_tool_calls_no_tools(step3p5_tool_parser): model_output = "This is a test response without any tool calls" extracted_tool_calls = step3p5_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert not extracted_tool_calls.tools_called assert extracted_tool_calls.tool_calls == [] assert extracted_tool_calls.content == model_output diff --git a/tests/tool_parsers/test_xlam_tool_parser.py b/tests/tool_parsers/test_xlam_tool_parser.py index 4478e97a60..94e3e37880 100644 --- a/tests/tool_parsers/test_xlam_tool_parser.py +++ b/tests/tool_parsers/test_xlam_tool_parser.py @@ -100,7 +100,7 @@ def test_extract_tool_calls_no_tools(xlam_tool_parser): model_output = "This is a test" extracted_tool_calls = xlam_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert not extracted_tool_calls.tools_called assert extracted_tool_calls.tool_calls == [] assert extracted_tool_calls.content == model_output @@ -225,7 +225,7 @@ def test_extract_tool_calls( ): extracted_tool_calls = xlam_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert extracted_tool_calls.tools_called assert_tool_calls(extracted_tool_calls.tool_calls, expected_tool_calls) @@ -263,7 +263,7 @@ def test_extract_tool_calls_list_structure( """Test extraction of tool calls when the model outputs a list-structured tool call.""" # noqa: E501 extracted_tool_calls = xlam_tool_parser.extract_tool_calls( model_output, request=None - ) # type: ignore[arg-type] + ) assert extracted_tool_calls.tools_called 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 if delta.tool_calls and delta.tool_calls[0].function.arguments ) else: - extracted = xlam_tool_parser.extract_tool_calls(model_output, request=None) # type: ignore[arg-type] + extracted = xlam_tool_parser.extract_tool_calls(model_output, request=None) args = "".join(tc.function.arguments for tc in extracted.tool_calls) assert "北京" in args diff --git a/tests/tool_use/test_gemma4_responses_adjust_request.py b/tests/tool_use/test_gemma4_responses_adjust_request.py index 403c707924..fabfa74766 100644 --- a/tests/tool_use/test_gemma4_responses_adjust_request.py +++ b/tests/tool_use/test_gemma4_responses_adjust_request.py @@ -148,7 +148,7 @@ def test_tool_parser_adjust_request_builds_valid_response_text_config() -> None: description string that the previous two-step construction injected. """ parser = ToolParser.__new__(ToolParser) - parser.model_tokenizer = None # type: ignore[assignment] + parser.model_tokenizer = None request = _build_responses_request(tool_choice="required") ToolParser.adjust_request(parser, request) diff --git a/tests/tool_use/test_kimi_k3_tool_parser.py b/tests/tool_use/test_kimi_k3_tool_parser.py index ac7dcfb8ac..05679bd192 100644 --- a/tests/tool_use/test_kimi_k3_tool_parser.py +++ b/tests/tool_use/test_kimi_k3_tool_parser.py @@ -370,7 +370,7 @@ def test_streaming_split_markers_do_not_leak(): assert len(tool_deltas) == 1 assert tool_deltas[0].function is not None assert tool_deltas[0].function.name == "calc" - assert json.loads(tool_deltas[0].function.arguments) == {"x": 1} # type: ignore[arg-type] + assert json.loads(tool_deltas[0].function.arguments) == {"x": 1} def test_tool_call_ids_are_unique_across_messages(): diff --git a/tests/transformers_utils/processors/test_voxtral.py b/tests/transformers_utils/processors/test_voxtral.py index 0ca8f1a94d..015d3b005e 100644 --- a/tests/transformers_utils/processors/test_voxtral.py +++ b/tests/transformers_utils/processors/test_voxtral.py @@ -98,7 +98,7 @@ def test_fetch_audio_rejects_unsupported_type( feature_extractor: MistralCommonFeatureExtractor, ): with pytest.raises(TypeError, match="only a numpy array"): - feature_extractor.fetch_audio(42) # type: ignore[arg-type] + feature_extractor.fetch_audio(42) def test_fetch_audio_str_delegates_to_load_audio( diff --git a/tests/transformers_utils/test_processor.py b/tests/transformers_utils/test_processor.py index e9070619d9..a3a1c78418 100644 --- a/tests/transformers_utils/test_processor.py +++ b/tests/transformers_utils/test_processor.py @@ -44,7 +44,7 @@ class _ProcWithUnpack: def test_get_processor_kwargs_from_processor_unpack_path_returns_full_union(): proc = _ProcWithUnpack() - keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) # type: ignore[arg-type] + keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) _assert_has_all_expected(keys) @@ -63,5 +63,5 @@ def test_get_processor_kwargs_from_processor_module_scan_returns_full_union(): assert hasattr(mod, "_FakeProcessorKwargs") proc = _ProcWithoutUnpack() - keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) # type: ignore[arg-type] + keys = get_processor_kwargs_keys(get_processor_kwargs_type(proc)) _assert_has_all_expected(keys) diff --git a/tests/utils.py b/tests/utils.py index 10fcffffea..dd6bf4ae96 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -830,7 +830,7 @@ class RemoteOpenAIServerCustom(RemoteOpenAIServer): self.proc: Process = cast(Any, ctx).Process( target=_run_in_new_process_group, args=(self.child_process_fxn, env_dict, model, vllm_serve_args), - ) # type: ignore[assignment] + ) with _temporarily_sanitized_pythonpath_env(): self.proc.start() diff --git a/tests/utils_/test_argparse_utils.py b/tests/utils_/test_argparse_utils.py index 815ac3fa19..89e0f9977d 100644 --- a/tests/utils_/test_argparse_utils.py +++ b/tests/utils_/test_argparse_utils.py @@ -476,32 +476,32 @@ def test_compilation_config_mode_validator(): """Test that CompilationConfig.mode field validator converts strings to integers.""" from vllm.config.compilation import CompilationConfig, CompilationMode - config = CompilationConfig(mode=0) # type: ignore[arg-type] + config = CompilationConfig(mode=0) assert config.mode == CompilationMode.NONE - config = CompilationConfig(mode=3) # type: ignore[arg-type] + config = CompilationConfig(mode=3) assert config.mode == CompilationMode.VLLM_COMPILE - config = CompilationConfig(mode="NONE") # type: ignore[arg-type] + config = CompilationConfig(mode="NONE") assert config.mode == CompilationMode.NONE - config = CompilationConfig(mode="STOCK_TORCH_COMPILE") # type: ignore[arg-type] + config = CompilationConfig(mode="STOCK_TORCH_COMPILE") assert config.mode == CompilationMode.STOCK_TORCH_COMPILE - config = CompilationConfig(mode="DYNAMO_TRACE_ONCE") # type: ignore[arg-type] + config = CompilationConfig(mode="DYNAMO_TRACE_ONCE") assert config.mode == CompilationMode.DYNAMO_TRACE_ONCE - config = CompilationConfig(mode="VLLM_COMPILE") # type: ignore[arg-type] + config = CompilationConfig(mode="VLLM_COMPILE") assert config.mode == CompilationMode.VLLM_COMPILE - config = CompilationConfig(mode="none") # type: ignore[arg-type] + config = CompilationConfig(mode="none") assert config.mode == CompilationMode.NONE - config = CompilationConfig(mode="vllm_compile") # type: ignore[arg-type] + config = CompilationConfig(mode="vllm_compile") assert config.mode == CompilationMode.VLLM_COMPILE with pytest.raises(ValidationError, match="Invalid compilation mode"): - CompilationConfig(mode="INVALID_MODE") # type: ignore[arg-type] + CompilationConfig(mode="INVALID_MODE") def test_flat_product(): diff --git a/tests/v1/attention/test_mla_prefill_selector.py b/tests/v1/attention/test_mla_prefill_selector.py index 87d188c6a0..d5b81695aa 100644 --- a/tests/v1/attention/test_mla_prefill_selector.py +++ b/tests/v1/attention/test_mla_prefill_selector.py @@ -511,14 +511,14 @@ class TestMLAPrefillBackendParsing: def test_valid_string_parses_to_enum(self): config = AttentionConfig( - mla_prefill_backend="FLASH_ATTN", # type: ignore[arg-type] + mla_prefill_backend="FLASH_ATTN", ) assert config.mla_prefill_backend == MLAPrefillBackendEnum.FLASH_ATTN def test_invalid_string_raises_error(self): with pytest.raises(ValueError, match="Unknown MLA prefill backend"): AttentionConfig( - mla_prefill_backend="NONEXISTENT", # type: ignore[arg-type] + mla_prefill_backend="NONEXISTENT", ) diff --git a/tests/v1/attention/test_sparse_mla_backends.py b/tests/v1/attention/test_sparse_mla_backends.py index 1ea1415029..048eb40586 100644 --- a/tests/v1/attention/test_sparse_mla_backends.py +++ b/tests/v1/attention/test_sparse_mla_backends.py @@ -3575,7 +3575,7 @@ def test_flashmla_fp8_paths_accept_decode_subset(monkeypatch, use_mixed_batch: b if use_mixed_batch: fp8_metadata = FlashMLASparseMetadata.FP8KernelMetadata( - scheduler_metadata=object(), # type: ignore[arg-type] + scheduler_metadata=object(), dummy_block_table=torch.empty(1, 1, dtype=torch.int32, device=DEVICE_TYPE), cache_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE), ) @@ -3588,7 +3588,7 @@ def test_flashmla_fp8_paths_accept_decode_subset(monkeypatch, use_mixed_batch: b num_prefill_tokens=num_batch_tokens - num_decode_tokens, decode=FP8Meta.Decode( seq_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE), - kernel_metadata=object(), # type: ignore[arg-type] + kernel_metadata=object(), decode_query_len=num_decode_tokens, ), prefill=FP8Meta.Prefill( @@ -3774,7 +3774,7 @@ def test_fp8_mixed_batch_dcp_neutralizes_empty_rows(monkeypatch): metadata = SimpleNamespace( fp8_extra_metadata=FlashMLASparseMetadata.FP8KernelMetadata( - scheduler_metadata=object(), # type: ignore[arg-type] + scheduler_metadata=object(), dummy_block_table=torch.empty(1, 1, dtype=torch.int32, device=DEVICE_TYPE), cache_lens=torch.empty(1, dtype=torch.int32, device=DEVICE_TYPE), ), diff --git a/tests/v1/cudagraph/test_cudagraph_manager.py b/tests/v1/cudagraph/test_cudagraph_manager.py index e5f2f6369f..366db7b025 100644 --- a/tests/v1/cudagraph/test_cudagraph_manager.py +++ b/tests/v1/cudagraph/test_cudagraph_manager.py @@ -134,7 +134,7 @@ def test_piecewise_capture_uses_pcp_dummy_slot_mappings(): device=torch.device("cpu"), max_num_reqs=num_reqs, max_num_tokens=num_tokens, - block_tables=pcp_block_tables, # type: ignore[arg-type] + block_tables=pcp_block_tables, ) block_tables = MagicMock() @@ -224,7 +224,7 @@ def test_speculator_capture_preserves_decode_query_bounds( ) manager = SpeculatorCudaGraphManager.__new__(SpeculatorCudaGraphManager) manager.max_num_reqs = num_reqs - manager.vllm_config = SimpleNamespace( # type: ignore[assignment] + manager.vllm_config = SimpleNamespace( parallel_config=SimpleNamespace(data_parallel_size=1) ) buffers = InputBuffers(num_reqs, num_tokens, torch.device("cpu")) diff --git a/tests/v1/cudagraph/test_encoder_cudagraph.py b/tests/v1/cudagraph/test_encoder_cudagraph.py index 2f4de52b18..749f9aa20d 100644 --- a/tests/v1/cudagraph/test_encoder_cudagraph.py +++ b/tests/v1/cudagraph/test_encoder_cudagraph.py @@ -652,7 +652,7 @@ def test_eonly_capture_preserves_outputs_across_replay_and_fallback(profile_only encoder.device = device encoder.cudagraph_manager = manager runner = object.__new__(MMEncoderModelRunner) - runner.model_state = SimpleNamespace(encoder_runner=encoder) # type: ignore[assignment] + runner.model_state = SimpleNamespace(encoder_runner=encoder) # No decoder manager is installed: capture must be encoder-only. with patch( "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 with patch( "vllm.v1.worker.gpu.ec_connector.get_ec_transfer", return_value=connector ): - ec = ActiveECConnector(SimpleNamespace(), cache) # type: ignore[arg-type] + ec = ActiveECConnector(SimpleNamespace(), cache) scheduled = cast( SchedulerOutput, SimpleNamespace( @@ -716,7 +716,7 @@ def test_eonly_without_encoder_graph_skips_capture(): encoder = object.__new__(EncoderRunner) encoder.cudagraph_manager = None runner = object.__new__(MMEncoderModelRunner) - runner.model_state = SimpleNamespace(encoder_runner=encoder) # type: ignore[assignment] + runner.model_state = SimpleNamespace(encoder_runner=encoder) assert runner.capture_model() == 0 @@ -1023,7 +1023,7 @@ class TestInitInvariantValidation: vllm_config = _MockVllmConfig(token_budgets, max_mm_items) model = _MockModel(min_budget, max_budget) return EncoderCudaGraphManager( - vllm_config=vllm_config, # type: ignore[arg-type] + vllm_config=vllm_config, device=torch.device("cpu"), dtype=torch.float32, model=model, diff --git a/tests/v1/distributed/test_eagle_dp.py b/tests/v1/distributed/test_eagle_dp.py index bb2b9f9fae..019f9c6f21 100644 --- a/tests/v1/distributed/test_eagle_dp.py +++ b/tests/v1/distributed/test_eagle_dp.py @@ -61,7 +61,7 @@ async def test_run_eagle_dp(monkeypatch: pytest.MonkeyPatch, attn_backend: str): data_parallel_backend="mp", # ray takes more time trust_remote_code=True, max_model_len=16384, - attention_config={"backend": attn_backend}, # type: ignore[arg-type] + attention_config={"backend": attn_backend}, ) eagle_engine_args = replace( diff --git a/tests/v1/engine/test_startup_watch_processes.py b/tests/v1/engine/test_startup_watch_processes.py index feb1e04268..19b2d7bca8 100644 --- a/tests/v1/engine/test_startup_watch_processes.py +++ b/tests/v1/engine/test_startup_watch_processes.py @@ -304,9 +304,9 @@ def test_wait_for_engine_startup_reports_watched_process_exit(): wait_for_engine_startup( handshake_socket, [CoreEngine()], - parallel_config, # type: ignore[arg-type] + parallel_config, coordinated_dp=False, - cache_config=None, # type: ignore[arg-type] + cache_config=None, launch=launch, ) finally: diff --git a/tests/v1/executor/test_executor.py b/tests/v1/executor/test_executor.py index 949282cffb..806298acc6 100644 --- a/tests/v1/executor/test_executor.py +++ b/tests/v1/executor/test_executor.py @@ -126,7 +126,7 @@ def test_custom_executor_type_checking(): model=MODEL, gpu_memory_utilization=0.2, max_model_len=8192, - distributed_executor_backend=Mock, # type: ignore[arg-type] + distributed_executor_backend=Mock, ) LLMEngine.from_engine_args(engine_args) with pytest.raises(ValueError): @@ -134,7 +134,7 @@ def test_custom_executor_type_checking(): model=MODEL, gpu_memory_utilization=0.2, max_model_len=8192, - distributed_executor_backend=Mock, # type: ignore[arg-type] + distributed_executor_backend=Mock, ) AsyncLLM.from_engine_args(engine_args) diff --git a/tests/v1/kv_connector/unit/offloading_connector/test_metrics.py b/tests/v1/kv_connector/unit/offloading_connector/test_metrics.py index b7d9d6c8ef..e9ca7cb466 100644 --- a/tests/v1/kv_connector/unit/offloading_connector/test_metrics.py +++ b/tests/v1/kv_connector/unit/offloading_connector/test_metrics.py @@ -480,7 +480,7 @@ def test_reset(): def test_prom_metrics_observes_manager_counter(): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -506,7 +506,7 @@ def test_prom_metrics_observes_manager_counter(): def test_prom_metrics_observes_flat_transfer_metrics_and_legacy_metrics(): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -568,7 +568,7 @@ def test_prom_metrics_observes_manager_gauge_and_histogram(): return_value=_spec_cls_with_metric_definitions(metric_definitions), ): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(store_threshold=0), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -612,7 +612,7 @@ def test_prom_metrics_lazily_observes_labeled_metric(): return_value=_spec_cls_with_metric_definitions(metric_definitions), ): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(store_threshold=0), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -651,7 +651,7 @@ def test_prom_metrics_rejects_wrong_label_count(): return_value=_spec_cls_with_metric_definitions(metric_definitions), ): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(store_threshold=0), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -672,7 +672,7 @@ def test_prom_metrics_rejects_wrong_label_count(): def test_prom_metrics_uses_configured_manager_metrics(): prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(store_threshold=0), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -693,7 +693,7 @@ def test_prom_metrics_registers_tiering_metrics_from_spec(): "spec_name": "TieringOffloadingSpec", "secondary_tiers": [], }, - ), # type: ignore[arg-type] + ), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -741,7 +741,7 @@ def test_aggregate_into_empty_stats(): def test_prom_metrics_multi_engine_routing(): """Metrics are routed to the correct engine index.""" prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, @@ -767,7 +767,7 @@ def test_prom_metrics_multi_engine_routing(): def test_prom_metrics_rejects_undeclared_metric(): """observe() asserts if a metric was never declared in metadata.""" prom_metrics = OffloadPromMetrics( - vllm_config=_FakeVllmConfig(store_threshold=0), # type: ignore[arg-type] + vllm_config=_FakeVllmConfig(store_threshold=0), metric_types={ Gauge: _FakeMetric, Counter: _FakeMetric, diff --git a/tests/v1/kv_connector/unit/test_mooncake_store_worker.py b/tests/v1/kv_connector/unit/test_mooncake_store_worker.py index 1ef77e285a..cb6bd8d995 100644 --- a/tests/v1/kv_connector/unit/test_mooncake_store_worker.py +++ b/tests/v1/kv_connector/unit/test_mooncake_store_worker.py @@ -1543,7 +1543,7 @@ def test_store_sending_thread_reports_job_when_the_preamble_raises(): # every dequeue leaves through the same exit. thread = _make_store_sending_thread(MagicMock()) req = _make_store_req("req-a", [b"a0", b"a1"]) - req.token_len_chunk = None # type: ignore[assignment] + req.token_len_chunk = None with contextlib.suppress(TypeError): _run_store_req(thread, req) diff --git a/tests/v1/kv_connector/unit/test_nixl_connector.py b/tests/v1/kv_connector/unit/test_nixl_connector.py index 017dee10d8..6be77b7b9d 100644 --- a/tests/v1/kv_connector/unit/test_nixl_connector.py +++ b/tests/v1/kv_connector/unit/test_nixl_connector.py @@ -114,7 +114,7 @@ def get_default_xfer_telemetry( class AttributeDict(dict): __slots__ = () __getattr__ = dict.__getitem__ - __setattr__ = dict.__setitem__ # type: ignore[assignment] + __setattr__ = dict.__setitem__ # We can't instantiate nixlXferTelemetry because it's read only and # ray env does not have NIXL, so we must fake it diff --git a/tests/v1/kv_connector/unit/test_nixl_push_connector.py b/tests/v1/kv_connector/unit/test_nixl_push_connector.py index 7ce6666ae8..de47376117 100644 --- a/tests/v1/kv_connector/unit/test_nixl_push_connector.py +++ b/tests/v1/kv_connector/unit/test_nixl_push_connector.py @@ -1256,7 +1256,7 @@ class TestPushWriterNegative: w = _StubWriterWorker.fresh() for bogus_rid in (123, None, 4.5, b"bytes-not-str"): payload = _registration_data("placeholder") - payload["request_id"] = bogus_rid # type: ignore[assignment] + payload["request_id"] = bogus_rid notif = PUSH_REG_NOTIF_PREFIX + msgspec.msgpack.encode(payload) w._handle_push_reg_notif(notif) assert w._pending_d_registrations == {} diff --git a/tests/v1/kv_offload/tiering/p2p/test_manager.py b/tests/v1/kv_offload/tiering/p2p/test_manager.py index 8e806582fd..e35b1d022e 100644 --- a/tests/v1/kv_offload/tiering/p2p/test_manager.py +++ b/tests/v1/kv_offload/tiering/p2p/test_manager.py @@ -349,10 +349,10 @@ class TestServeExternalRequests: mgr._failed_serve_ctxs = [ctx] sess_a = _RecordingSession() sess_b = _RecordingSession() - mgr._sessions = {"a": sess_a, "b": sess_b} # type: ignore[assignment] + mgr._sessions = {"a": sess_a, "b": sess_b} parent = _RecordingParent() - mgr.serve_external_requests(parent) # type: ignore[arg-type] + mgr.serve_external_requests(parent) # Failed serve released and queue cleared. assert parent.finished == ["p2p:peer:req-1:lu1"] @@ -364,10 +364,10 @@ class TestServeExternalRequests: def test_no_failed_serves_still_serves_sessions(self): mgr = _make_manager() sess = _RecordingSession() - mgr._sessions = {"a": sess} # type: ignore[assignment] + mgr._sessions = {"a": sess} parent = _RecordingParent() - mgr.serve_external_requests(parent) # type: ignore[arg-type] + mgr.serve_external_requests(parent) assert parent.finished == [] assert sess.served_with == [parent] @@ -427,7 +427,7 @@ class TestSubmitStore: forwards directly to that session rather than re-buffering.""" mgr = _make_manager() bound = _FakeSession(peer_id="10.0.0.1:8000", connected=True) - mgr._kv_to_session["req-1"] = bound # type: ignore[assignment] + mgr._kv_to_session["req-1"] = bound # Note: _sessions is intentionally untouched — this test isolates # the kv_request_id → session fast path. job = _job_metadata( @@ -495,7 +495,7 @@ class TestSubmitLoad: mgr = _make_manager() peer_id = "10.0.0.1:8000" existing = _FakeSession(peer_id=peer_id, connected=True) - mgr._sessions[peer_id] = existing # type: ignore[assignment] + mgr._sessions[peer_id] = existing job = _job_metadata( job_id=42, keys=[b"k1", b"k2"], @@ -581,7 +581,7 @@ class TestOnRequestFinished: (FetchMsg received) routes via _kv_to_session and pops the entry.""" mgr = _make_manager() bound = _FakeSession(peer_id="some-peer:1", connected=True) - mgr._kv_to_session["req-1"] = bound # type: ignore[assignment] + mgr._kv_to_session["req-1"] = bound ctx = _req_context(kv_params=_remote_decoder_kv_params(kv_request_id="req-1")) mgr.on_request_finished(ctx) assert bound.finishes == ["req-1"] @@ -718,8 +718,8 @@ class TestGetFinished: def poll(self): return [] - mgr._control = FakeControl() # type: ignore[assignment] - mgr._data = None # type: ignore[assignment] + mgr._control = FakeControl() + mgr._data = None return mgr def test_drains_finished_jobs(self): @@ -740,7 +740,7 @@ class TestGetFinished: pass mgr = self._make() - mgr._data = FakeData() # type: ignore[assignment] + mgr._data = FakeData() dead = _FakeSession( peer_id="dead:1234", alive=False, @@ -749,7 +749,7 @@ class TestGetFinished: close_req_ids=["req-load"], close_stores=[10, 11], ) - mgr._sessions["dead:1234"] = dead # type: ignore[assignment] + mgr._sessions["dead:1234"] = dead results = list(mgr.get_finished_jobs()) # 2 baseline + 1 failed load + 2 failed stores @@ -769,14 +769,14 @@ class TestGetFinished: pass mgr = self._make() - mgr._data = FakeData() # type: ignore[assignment] + mgr._data = FakeData() dead = _FakeSession( peer_id="dead:1234", alive=False, connected=True, close_req_ids=["req-probe-1", "req-probe-2"], ) - mgr._sessions["dead:1234"] = dead # type: ignore[assignment] + mgr._sessions["dead:1234"] = dead list(mgr.get_finished_jobs()) assert "dead:1234" not in mgr._sessions @@ -854,7 +854,7 @@ class TestHasPendingWork: """The result is the same regardless of session state — there is no 'idle' branch.""" mgr = _make_manager() - mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") # type: ignore[assignment] + mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") assert mgr.has_pending_work() is True @@ -919,12 +919,12 @@ class TestShutdownDrain: mgr = _make_manager() data = _ShutdownFakeData(still_queue=still_queue) control = _ShutdownFakeControl() - mgr._data = data # type: ignore[assignment] - mgr._control = control # type: ignore[assignment] + mgr._data = data + mgr._control = control if inflight_ids: session = _FakeSession(peer_id="peer:1", connected=True) session._server._inflight = {tid: object() for tid in inflight_ids} - mgr._sessions["peer:1"] = session # type: ignore[assignment] + mgr._sessions["peer:1"] = session return mgr, data, control def test_shutdown_drains_inflight_via_wait_cancel(self): @@ -1148,10 +1148,10 @@ def _build_paired_managers() -> tuple[P2PSecondaryTierManager, P2PSecondaryTierM ctrl_b = _LoopbackControl(mgr_b._local_id) ctrl_a.pair(ctrl_b) - mgr_a._control = ctrl_a # type: ignore[assignment] - mgr_b._control = ctrl_b # type: ignore[assignment] - mgr_a._data = _FakeData(mgr_a._local_id) # type: ignore[assignment] - mgr_b._data = _FakeData(mgr_b._local_id) # type: ignore[assignment] + mgr_a._control = ctrl_a + mgr_b._control = ctrl_b + mgr_a._data = _FakeData(mgr_a._local_id) + mgr_b._data = _FakeData(mgr_b._local_id) return mgr_a, mgr_b @@ -1334,7 +1334,7 @@ class TestAcceptNewPeers: mgr = _make_manager() peer_id = "10.0.0.1:8000" existing = _FakeSession(peer_id=peer_id, connected=True) - mgr._sessions[peer_id] = existing # type: ignore[assignment] + mgr._sessions[peer_id] = existing new_conn = _RecordingConn(peer_id) mgr._accept_new_peers([new_conn]) @@ -1365,7 +1365,7 @@ class TestAcceptNewPeers: pass mgr = _make_manager() - mgr._data = FakeData() # type: ignore[assignment] + mgr._data = FakeData() peer_id = "10.0.0.1:8000" # Real ControlConnection-shaped fake: send/close/peer_id only. @@ -1382,7 +1382,7 @@ class TestAcceptNewPeers: def close(self) -> None: self.alive = False - mgr._accept_new_peers([_Conn(peer_id)]) # type: ignore[arg-type] + mgr._accept_new_peers([_Conn(peer_id)]) assert peer_id in mgr._sessions assert mgr._sessions[peer_id].connected is True @@ -1411,7 +1411,7 @@ class TestPollOnce: loads=[LoadResult(job_id=11, kv_request_id="req-11", success=True)], stores=[StoreResult(job_id=22, success=True)], ) - mgr._sessions[peer_alive] = alive # type: ignore[assignment] + mgr._sessions[peer_alive] = alive # Dead session whose pending close() jobs surface as failures. peer_dead = "10.0.0.3:9999" @@ -1423,7 +1423,7 @@ class TestPollOnce: close_req_ids=["req-33"], close_stores=[44], ) - mgr._sessions[peer_dead] = dead # type: ignore[assignment] + mgr._sessions[peer_dead] = dead class _Ctrl: def poll(self_inner): @@ -1433,8 +1433,8 @@ class TestPollOnce: def remove_remote_peer(self_inner, pid): pass - mgr._control = _Ctrl() # type: ignore[assignment] - mgr._data = _Data() # type: ignore[assignment] + mgr._control = _Ctrl() + mgr._data = _Data() mgr._poll_once() @@ -1464,7 +1464,7 @@ class TestPollOnce: connected=True, new_fetch_ids=["req-1"], ) - mgr._sessions[peer] = sess # type: ignore[assignment] + mgr._sessions[peer] = sess mgr._unbound_stores["req-1"] = [ _UnboundStoreBatch(job_id=5, keys=[b"k1"], block_ids=[0]), _UnboundStoreBatch(job_id=6, keys=[b"k2"], block_ids=[1]), @@ -1474,7 +1474,7 @@ class TestPollOnce: def poll(self_inner): return [] - mgr._control = _Ctrl() # type: ignore[assignment] + mgr._control = _Ctrl() mgr._poll_once() assert mgr._kv_to_session["req-1"] is sess @@ -1496,13 +1496,13 @@ class TestPollOnce: connected=True, new_fetch_ids=["req-fast"], ) - mgr._sessions[peer] = sess # type: ignore[assignment] + mgr._sessions[peer] = sess class _Ctrl: def poll(self_inner): return [] - mgr._control = _Ctrl() # type: ignore[assignment] + mgr._control = _Ctrl() mgr._poll_once() assert mgr._kv_to_session["req-fast"] is sess @@ -1519,13 +1519,13 @@ class TestPollOnce: connected=True, loads=[LoadResult(job_id=5, kv_request_id="req-5", success=False)], ) - mgr._sessions[peer] = sess # type: ignore[assignment] + mgr._sessions[peer] = sess class _Ctrl: def poll(self_inner): return [] - mgr._control = _Ctrl() # type: ignore[assignment] + mgr._control = _Ctrl() mgr._poll_once() @@ -1549,26 +1549,26 @@ class TestDrainJobs: def test_returns_immediately_when_quiescent(self): """No sessions and no inflight: drain_jobs returns without sleeping.""" mgr = _make_manager() - mgr._control = _DrainCtrl() # type: ignore[assignment] + mgr._control = _DrainCtrl() sleeps: list[float] = [] # If drain_jobs sleeps when nothing is pending, that's a regression. import vllm.v1.kv_offload.tiering.p2p.manager as m original_sleep = m.time.sleep - m.time.sleep = lambda s: sleeps.append(s) # type: ignore[assignment] + m.time.sleep = lambda s: sleeps.append(s) try: mgr.drain_jobs() finally: - m.time.sleep = original_sleep # type: ignore[assignment] + m.time.sleep = original_sleep assert sleeps == [] def test_returns_when_session_has_no_inflight_or_inbound(self): """A session with empty _inbound and _inflight does not block drain.""" mgr = _make_manager() - mgr._control = _DrainCtrl() # type: ignore[assignment] - mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") # type: ignore[assignment] + mgr._control = _DrainCtrl() + mgr._sessions["peer:1"] = _FakeSession(peer_id="peer:1") # Should return on the first iteration. mgr.drain_jobs() @@ -1576,10 +1576,10 @@ class TestDrainJobs: """A session that stays inflight past 5s triggers the warning, and once it clears the loop returns.""" mgr = _make_manager() - mgr._control = _DrainCtrl() # type: ignore[assignment] + mgr._control = _DrainCtrl() sess = _FakeSession(peer_id="peer:1") sess._server._inflight = {1: object()} # non-empty - mgr._sessions["peer:1"] = sess # type: ignore[assignment] + mgr._sessions["peer:1"] = sess # Synthetic monotonic clock: 100.0 for the start stamp, then 106.0 # for the first elapsed-check (past the 5s warning threshold), then diff --git a/tests/v1/kv_offload/tiering/p2p/test_sessions.py b/tests/v1/kv_offload/tiering/p2p/test_sessions.py index a09445668f..09739345be 100644 --- a/tests/v1/kv_offload/tiering/p2p/test_sessions.py +++ b/tests/v1/kv_offload/tiering/p2p/test_sessions.py @@ -288,17 +288,17 @@ def _make_session( session = P2PSession( peer_id=peer_id, local_id=local_id, - transport=transport, # type: ignore[arg-type] + transport=transport, local_block_len=transport.block_len, local_hash_seed=local_hash_seed, - conn=conn, # type: ignore[arg-type] + conn=conn, ) return session, conn, transport def _serve(session: P2PSession, parent: FakeParent) -> None: """Resolve enqueued inbound lookups, as the manager does each step.""" - session.serve_external_requests(parent) # type: ignore[arg-type] + session.serve_external_requests(parent) def _activate( @@ -1951,7 +1951,7 @@ class TestFinishRequestServerSide: ) session.poll() # Force write_blocks to fail on the next call. - transport.write_blocks = lambda *a, **kw: None # type: ignore[assignment] + transport.write_blocks = lambda *a, **kw: None # type: ignore[method-assign] session.add_stored_blocks("req-1", [b"k1"], [0], job_id=42) @@ -2057,7 +2057,7 @@ class TestFinishRequestServerSide: assert outbound.finishing is False # Round 2: write_blocks fails for k2 while transfer_1 is still inflight. - transport.write_blocks = lambda *a, **kw: None # type: ignore[assignment] + transport.write_blocks = lambda *a, **kw: None # type: ignore[method-assign] session.add_stored_blocks("req-1", [b"k2"], [1], job_id=200) # No new transfer was registered. assert list(session._server._inflight.keys()) == [tid_1] @@ -2163,7 +2163,7 @@ class TestPendingSession: session = P2PSession( peer_id="peer:8000", local_id="local:9000", - transport=transport, # type: ignore[arg-type] + transport=transport, local_block_len=4096, local_hash_seed=_DEFAULT_HASH_SEED, conn=None, @@ -2183,13 +2183,13 @@ class TestPendingSession: session = P2PSession( peer_id="peer:8000", local_id="local:9000", - transport=transport, # type: ignore[arg-type] + transport=transport, local_block_len=4096, local_hash_seed=_DEFAULT_HASH_SEED, conn=None, ) conn = FakeConnection(peer_id="peer:8000") - session.attach_connection(conn) # type: ignore[arg-type] + session.attach_connection(conn) assert conn._sent assert conn._sent[0][TYPE_KEY] == ConnectMsg.TYPE @@ -2197,7 +2197,7 @@ class TestPendingSession: """attach_connection on an already-connected session raises.""" session, conn, _ = _make_session() with pytest.raises(ValueError, match="already connected"): - session.attach_connection(FakeConnection()) # type: ignore[arg-type] + session.attach_connection(FakeConnection()) def test_pending_close_returns_pending_stores(self): """Closing a pending session reports buffered stores as failed.""" @@ -2205,7 +2205,7 @@ class TestPendingSession: session = P2PSession( peer_id="peer:8000", local_id="local:9000", - transport=transport, # type: ignore[arg-type] + transport=transport, local_block_len=4096, local_hash_seed=_DEFAULT_HASH_SEED, conn=None, @@ -2313,7 +2313,7 @@ class TestAdversarial: def test_non_dict_message(self): session, conn, _ = _make_session() _activate(session, conn) - conn._inbox.append(42) # type: ignore[arg-type] + conn._inbox.append(42) result_ = session.poll() loads = result_.loads stores = result_.stores @@ -2402,7 +2402,7 @@ class TestDispatchErrorHandling: def _boom(*args, **kwargs): raise RuntimeError("simulated internal bug") - session._server.on_fetch = _boom # type: ignore[assignment] + session._server.on_fetch = _boom conn.enqueue( { TYPE_KEY: FetchMsg.TYPE, @@ -2425,7 +2425,7 @@ class TestDispatchErrorHandling: def _boom(*args, **kwargs): raise RuntimeError("simulated internal bug") - session._server.on_fetch = _boom # type: ignore[assignment] + session._server.on_fetch = _boom for _ in range(_MAX_CONSECUTIVE_DISPATCH_ERRORS): conn.enqueue( { @@ -2454,7 +2454,7 @@ class TestDispatchErrorHandling: # Alternate (boom, success) (_MAX-1) times: counter rises to 1 # then resets to 0 each cycle, never reaching the threshold. for _ in range(_MAX_CONSECUTIVE_DISPATCH_ERRORS - 1): - session._server.on_fetch = _boom # type: ignore[assignment] + session._server.on_fetch = _boom conn.enqueue( { TYPE_KEY: FetchMsg.TYPE, @@ -2465,7 +2465,7 @@ class TestDispatchErrorHandling: } ) session.poll() - session._server.on_fetch = original_on_fetch # type: ignore[assignment] + session._server.on_fetch = original_on_fetch # A benign no-op message (unknown type) dispatches cleanly # and resets the consecutive-error counter. conn.enqueue({TYPE_KEY: "unknown_for_test"}) diff --git a/tests/v1/sample/test_dry.py b/tests/v1/sample/test_dry.py index f70d85eba4..50a5a5e0db 100644 --- a/tests/v1/sample/test_dry.py +++ b/tests/v1/sample/test_dry.py @@ -340,7 +340,7 @@ def _make_v2_state( device=device, all_token_ids=SimpleNamespace(gpu=all_tokens), ) - state = DryState(_make_vllm_config(), req_states) # type: ignore[arg-type] + state = DryState(_make_vllm_config(), req_states) if tokenizer is not None: # Re-resolve the default set now that a tokenizer is installed. state._tokenizer = tokenizer @@ -446,7 +446,7 @@ def test_spec_decode_is_refused_at_construction(): ) config = _make_vllm_config(speculative_config=SimpleNamespace()) with pytest.raises(ValueError, match="speculative decoding"): - DryState(config, req_states) # type: ignore[arg-type] + DryState(config, req_states) def test_v2_draft_expanded_logits_raise(): @@ -918,7 +918,7 @@ def test_loads_through_the_loader_by_fqcn(): ) procs = loader.build_custom_logits_processors( _make_vllm_config(), - req_states, # type: ignore[arg-type] + req_states, False, [DRY_FQCN], ) diff --git a/tests/v1/sample/test_logprobs.py b/tests/v1/sample/test_logprobs.py index 78524acbb5..2413c824fc 100644 --- a/tests/v1/sample/test_logprobs.py +++ b/tests/v1/sample/test_logprobs.py @@ -486,12 +486,12 @@ def test_prompt_logprob_token_ids_require_v2_model_runner(): params = SamplingParams(prompt_logprob_token_ids=[1, 2]) with patch.object(SamplingParams, "verify"): with pytest.raises(VLLMValidationError, match="V2 model runner"): - InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type] + InputProcessor._validate_params(processor, params, ("generate",)) processor.vllm_config.use_v2_model_runner = True - InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type] + InputProcessor._validate_params(processor, params, ("generate",)) processor.vllm_config.cache_config.kv_sharing_fast_prefill = True with pytest.raises(VLLMValidationError, match="fast-prefill"): - InputProcessor._validate_params(processor, params, ("generate",)) # type: ignore[arg-type] + InputProcessor._validate_params(processor, params, ("generate",)) def test_none_logprobs(vllm_model, example_prompts): diff --git a/tests/v1/sample/test_trace_replay_params.py b/tests/v1/sample/test_trace_replay_params.py index 0a70859f84..cf6e3a83f7 100644 --- a/tests/v1/sample/test_trace_replay_params.py +++ b/tests/v1/sample/test_trace_replay_params.py @@ -105,7 +105,7 @@ def test_trace_decode_token_ids_rejects_speculative_decoding(): with pytest.raises(ValueError, match="not supported with speculative decoding"): params._validate_trace_replay( _make_model_config(vocab_size=100), - speculative_config=object(), # type: ignore[arg-type] # Only non-None presence is tested. + speculative_config=object(), ) diff --git a/tests/v1/simple_kv_offload/test_worker.py b/tests/v1/simple_kv_offload/test_worker.py index 2936d0eb87..16e142d7cb 100644 --- a/tests/v1/simple_kv_offload/test_worker.py +++ b/tests/v1/simple_kv_offload/test_worker.py @@ -71,7 +71,7 @@ SLEEP_CYCLES = 50_000_000 def _make_worker( kv_cache_config: KVCacheConfig | None, cpu_capacity_bytes: int ) -> SimpleCPUOffloadWorker: - return SimpleCPUOffloadWorker(None, kv_cache_config, cpu_capacity_bytes) # type: ignore[arg-type] + return SimpleCPUOffloadWorker(None, kv_cache_config, cpu_capacity_bytes) def _make_backend() -> tuple[DmaCopyBackend, torch.Tensor, torch.Tensor]: @@ -121,7 +121,7 @@ def test_no_forward_step_completes_cpu_store(monkeypatch, use_v2): monkeypatch.setattr(f"{module}.get_forward_context", lambda: None) result = active.no_forward(output) else: - result = KVConnectorModelRunnerMixin.kv_connector_no_forward(output, None) # type: ignore[arg-type] + result = KVConnectorModelRunnerMixin.kv_connector_no_forward(output, None) completion = ( result.kv_connector_output.kv_connector_worker_meta if result.kv_connector_output is not None @@ -283,7 +283,7 @@ def test_transfer_hooks_pass_wait_event_for_store_only(): cpu_capacity_bytes=0, ) recording = _RecordingBackend() - worker._backend = recording # type: ignore[assignment] + worker._backend = recording worker._connector_metadata = SimpleCPUOffloadMetadata( load_event=0, load_gpu_blocks=[0], diff --git a/tests/v1/spec_decode/test_adaptive_verification.py b/tests/v1/spec_decode/test_adaptive_verification.py index 514a84d931..73c478a104 100644 --- a/tests/v1/spec_decode/test_adaptive_verification.py +++ b/tests/v1/spec_decode/test_adaptive_verification.py @@ -27,7 +27,7 @@ def make_manager( manager.num_speculative_steps = num_steps manager._stale_confidences = [SimpleNamespace(np=confidences)] # type: ignore[list-item] # CPU-only confidence buffer. manager._stale_idx = 0 - manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture. + manager.req_states = SimpleNamespace( req_id_to_index={"low": 0, "high": 1}, num_computed_tokens_np=np.ones(num_reqs, dtype=np.int32), prefill_len=SimpleNamespace(np=np.ones(num_reqs, dtype=np.int32)), @@ -153,11 +153,11 @@ def test_manager_checks_target_varlen_cudagraph_bound( manager = maybe_create_adaptive_verification_manager( enable_adaptive_verification=True, attn_groups=groups, - req_states=SimpleNamespace(num_speculative_steps=7), # type: ignore[arg-type] + req_states=SimpleNamespace(num_speculative_steps=7), query_start_loc=object(), num_bonus_tokens=1, max_total_logits=1, - vllm_config=None, # type: ignore[arg-type] + vllm_config=None, target_layer_names={"target"}, additional_attn_cg_support=additional, ) @@ -186,9 +186,7 @@ def test_budget_stops_where_marginal_drafts_stop_paying_for_themselves(): def test_profiled_batches_seed_cost_curves_via_consumer(monkeypatch): manager = AdaptiveVerificationManager.__new__(AdaptiveVerificationManager) - manager.req_states = SimpleNamespace( # type: ignore[assignment] # CPU-only request fixture. - max_num_batched_tokens=4096, max_num_reqs=64 - ) + manager.req_states = SimpleNamespace(max_num_batched_tokens=4096, max_num_reqs=64) manager.num_speculative_steps = 7 manager.num_bonus_tokens = 1 curves: dict[str, list[tuple[int, float]]] = {} diff --git a/tests/v1/spec_decode/test_dflash2.py b/tests/v1/spec_decode/test_dflash2.py index d5517ed61b..558bb38e6b 100644 --- a/tests/v1/spec_decode/test_dflash2.py +++ b/tests/v1/spec_decode/test_dflash2.py @@ -98,7 +98,7 @@ def test_draft_quant_exclusions_include_global_layer_indices(): ] ) - _add_global_draft_layer_exclusions(quant_config, 88, 5) # type: ignore[arg-type] + _add_global_draft_layer_exclusions(quant_config, 88, 5) assert "layers.88.mlp_conv*" in quant_config.exclude_modules 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): allocating one here would claim a proposal the walk never sampled from. """ _stub_base(monkeypatch, None) - speculator = DFlash2Speculator(None, torch.device("cpu")) # type: ignore[arg-type] # Base initialization is stubbed. + speculator = DFlash2Speculator(None, torch.device("cpu")) assert speculator.draft_logits is None @@ -183,7 +183,7 @@ def test_selector_asks_for_fp32_proposal_logits(): candidate row often enough that the walk and the rejection sampler checking it would no longer read the same distribution. """ - dtype, fill = DFlash2Speculator.draft_logits_spec(None, None) # type: ignore[arg-type] # Constant spec ignores self/config. + dtype, fill = DFlash2Speculator.draft_logits_spec(None, None) assert dtype is torch.float32 assert fill == float("-inf") @@ -309,9 +309,9 @@ def test_candidate_model_decoder_layer_cls(monkeypatch, variant): vllm_config.compilation_config = mock_current_vllm_config.compilation_config # 3. Instantiate the model under meta device to avoid parameter allocation issues - with set_current_vllm_config(mock_current_vllm_config), torch.device("meta"): # type: ignore[arg-type] + with set_current_vllm_config(mock_current_vllm_config), torch.device("meta"): model_cls = DFlash2Qwen3Model if variant == "dflash2" else LiLiCorr - model = model_cls(vllm_config=vllm_config) # type: ignore[arg-type] + model = model_cls(vllm_config=vllm_config) # 4. Assert that the layers are DFlash2Qwen3DecoderLayer (the subclass) assert len(model.layers) == 2 @@ -350,7 +350,7 @@ def test_conv_projections_use_draft_quant_config(monkeypatch): quant_method="W4A16_NVFP4", is_checkpoint_nvfp4_serialized=True ) layer = DFlash2Qwen3DecoderLayer( - SimpleNamespace( # type: ignore[arg-type] + SimpleNamespace( speculative_config=SimpleNamespace(num_speculative_tokens=7), model_config=SimpleNamespace(dtype=torch.bfloat16), ), @@ -434,7 +434,7 @@ def test_context_kv_uses_quantized_projection_fallback(monkeypatch): for projection in projections ] qwen3_dflash.DFlashQwen3Model._build_context_kv_buffers( - model, # type: ignore[arg-type] + model, layers_attn, has_bias=False, ) @@ -442,7 +442,7 @@ def test_context_kv_uses_quantized_projection_fallback(monkeypatch): assert all(not hasattr(projection, "weight") for projection in projections) actual_k, actual_v = qwen3_dflash.DFlashQwen3Model._project_context_kv( - model, # type: ignore[arg-type] + model, context_states, num_ctx=2, num_layers=2, diff --git a/tests/v1/spec_decode/test_dflash_lookahead.py b/tests/v1/spec_decode/test_dflash_lookahead.py index 55d039b05e..b139bfbecc 100644 --- a/tests/v1/spec_decode/test_dflash_lookahead.py +++ b/tests/v1/spec_decode/test_dflash_lookahead.py @@ -141,9 +141,9 @@ def test_dflash_drafter_window_reserves_bonus_token(): speculative_config=_dflash_speculative_config(NUM_SPECULATIVE_TOKENS), ) # window = 4, so 96 fits (96 + 4 == 100) but 97 does not (97 + 4 == 101) - assert input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=96)) # type: ignore[arg-type] - assert not input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=97)) # type: ignore[arg-type] - assert not input_fits_in_drafter(dflash_runner, None) # type: ignore[arg-type] # No metadata. + assert input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=96)) + assert not input_fits_in_drafter(dflash_runner, SimpleNamespace(max_seq_len=97)) + assert not input_fits_in_drafter(dflash_runner, None) # Other drafters don't reserve the bonus token, so 97 fits (97 + 3 == 100). plain_runner = SimpleNamespace( @@ -151,4 +151,4 @@ def test_dflash_drafter_window_reserves_bonus_token(): effective_drafter_max_model_len=100, speculative_config=SimpleNamespace(use_dflash=lambda: False), ) - assert input_fits_in_drafter(plain_runner, SimpleNamespace(max_seq_len=97)) # type: ignore[arg-type] + assert input_fits_in_drafter(plain_runner, SimpleNamespace(max_seq_len=97)) diff --git a/tests/v1/spec_decode/test_dsv4_mtp_local_argmax.py b/tests/v1/spec_decode/test_dsv4_mtp_local_argmax.py index 4efe53451e..a77615feef 100644 --- a/tests/v1/spec_decode/test_dsv4_mtp_local_argmax.py +++ b/tests/v1/spec_decode/test_dsv4_mtp_local_argmax.py @@ -158,9 +158,7 @@ def test_wrapper_forwards_spec_step_idx(): hidden_states = torch.empty(0) wrapper = object.__new__(DeepSeekV4MTP) - wrapper.model = SimpleNamespace( # type: ignore[assignment] - get_top_tokens=lambda *args: args - ) + wrapper.model = SimpleNamespace(get_top_tokens=lambda *args: args) assert DeepSeekV4MTP.get_top_tokens(wrapper, hidden_states, 2) == (hidden_states, 2) assert DeepSeekV4MTP.get_top_tokens(wrapper, hidden_states) == (hidden_states, 0) diff --git a/tests/v1/spec_decode/test_extract_hidden_states.py b/tests/v1/spec_decode/test_extract_hidden_states.py index 0c9197bb6a..c309ed569a 100644 --- a/tests/v1/spec_decode/test_extract_hidden_states.py +++ b/tests/v1/spec_decode/test_extract_hidden_states.py @@ -51,7 +51,7 @@ def _create_proposer( target_parallel_config=ParallelConfig(), method="extract_hidden_states", num_speculative_tokens=num_speculative_tokens, - draft_model_config={ # type: ignore[arg-type] + draft_model_config={ "hf_config": { "eagle_aux_hidden_state_layer_ids": layer_ids, } @@ -103,7 +103,7 @@ def test_proposer_initialization_missing_layer_ids(): target_parallel_config=ParallelConfig(), method="extract_hidden_states", num_speculative_tokens=1, - draft_model_config={ # type: ignore[arg-type] + draft_model_config={ "hf_config": {} # Missing eagle_aux_hidden_state_layer_ids }, ) @@ -363,7 +363,7 @@ def test_extract_hidden_states_text_only_config_regression(): target_parallel_config=ParallelConfig(), method="extract_hidden_states", num_speculative_tokens=1, - draft_model_config={ # type: ignore[arg-type] + draft_model_config={ "hf_config": { "eagle_aux_hidden_state_layer_ids": [1, 2, 3, 4], } @@ -450,7 +450,7 @@ def test_extract_hidden_states_speculative_config_vlm(): target_parallel_config=ParallelConfig(), method="extract_hidden_states", num_speculative_tokens=1, - draft_model_config={ # type: ignore[arg-type] + draft_model_config={ "hf_config": { "eagle_aux_hidden_state_layer_ids": [1, 2], } diff --git a/tests/v1/spec_decode/test_lilicorr.py b/tests/v1/spec_decode/test_lilicorr.py index 88c91696f3..5a42f3826a 100644 --- a/tests/v1/spec_decode/test_lilicorr.py +++ b/tests/v1/spec_decode/test_lilicorr.py @@ -190,17 +190,17 @@ def test_runtime_length_keeps_trained_checkpoint_geometry(monkeypatch): for slots in (1, 3): spec.num_speculative_tokens = slots head = LiLiCorr( - vllm_config=SimpleNamespace(speculative_config=spec) # type: ignore[arg-type] + vllm_config=SimpleNamespace(speculative_config=spec) ).lilicorr assert head.slot_embedding.shape == (1, 1, 3, 1, 8) assert head.relative_slot_bias.shape == (2, 7) spec.draft_model_config.hf_config.dflash_config["lilicorr_enabled"] = False with pytest.raises(ValueError, match="lilicorr_enabled"): - LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) # type: ignore[arg-type] + LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) spec.draft_model_config.hf_config.dflash_config["lilicorr_enabled"] = True spec.num_speculative_tokens = 4 with pytest.raises(ValueError, match="trained block_size"): - LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) # type: ignore[arg-type] + LiLiCorr(vllm_config=SimpleNamespace(speculative_config=spec)) @pytest.mark.parametrize("tp_size", [1, 2]) @@ -269,8 +269,8 @@ def test_candidates_use_global_partition_and_exclude_padding(monkeypatch, tp_siz ) monkeypatch.setattr(logits_processor, "_topk", lambda x, k: x.topk(k, dim=-1)) ids, values = logits_processor.LogitsProcessor.get_top_k_tokens( - fake, # type: ignore[arg-type] - lm_head, # type: ignore[arg-type] + fake, + lm_head, torch.empty(2, 1), 2, return_log_probs=True, @@ -291,13 +291,13 @@ def test_context_anchor_is_last_committed_normalized_feature(): anchor_valid=torch.ones(4, dtype=torch.bool), ) batch = SimpleNamespace(num_reqs=2, query_start_loc=torch.tensor([0, 2, 6])) - LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([0, 2])) # type: ignore[arg-type] + LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([0, 2])) torch.testing.assert_close(spec.anchor_hidden[:2], norm(hidden[[1, 3]])) assert spec.anchor_valid.tolist() == [True, True, False, False] assert not spec.anchor_hidden[2:].any() # A smaller reordered batch must not retain an old request's anchor. batch = SimpleNamespace(num_reqs=1, query_start_loc=torch.tensor([0, 3])) - LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([1])) # type: ignore[arg-type] + LiLiCorrSpeculator.prepare_context_anchor(spec, batch, torch.tensor([1])) torch.testing.assert_close(spec.anchor_hidden[0], norm(hidden[1])) assert not spec.anchor_hidden[1:].any() @@ -321,7 +321,7 @@ def test_candidate_generation_routes_scores_and_adaptive_inputs(monkeypatch, lil monkeypatch.setattr(DFlashSpeculator, "__init__", init_base) cls = LiLiCorrSpeculator if lilicorr else DFlash2Speculator - spec = cls(None, torch.device("cpu")) # type: ignore[arg-type] + spec = cls(None, torch.device("cpu")) hidden = torch.arange(36).float().view(9, 4) spec._run_model = lambda *args: hidden 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 spec.draft_logits = None spec.use_fp64_gumbel = False spec.enable_adaptive_verification = True - spec.input_buffers = SimpleNamespace(input_ids=torch.arange(9)) # type: ignore[assignment] + spec.input_buffers = SimpleNamespace(input_ids=torch.arange(9)) candidates = torch.arange(24).view(6, 4) log_probs = candidates.float().log_softmax(-1) scores = torch.randn(3, 2, 4, 4) @@ -636,7 +636,7 @@ def owned_head_model(monkeypatch): compilation_config=CompilationConfig(mode=CompilationMode.NONE), ) ): - model = LiLiCorrForCausalLM(vllm_config=vllm_config) # type: ignore[arg-type] + model = LiLiCorrForCausalLM(vllm_config=vllm_config) return model, vllm_config return build @@ -746,7 +746,7 @@ def test_quantized_head_calls_methods_without_reading_packed_weights(monkeypatch block_size=4, rms_norm_eps=1e-6, config=_config(hidden_size=8), - quant_config=quant_config, # type: ignore[arg-type] + quant_config=quant_config, prefix="model.lilicorr", ) with torch.no_grad(): diff --git a/tests/v1/spec_decode/test_llm_base_proposer.py b/tests/v1/spec_decode/test_llm_base_proposer.py index f9c1795b97..fb1ecdd2df 100644 --- a/tests/v1/spec_decode/test_llm_base_proposer.py +++ b/tests/v1/spec_decode/test_llm_base_proposer.py @@ -53,7 +53,7 @@ def _make_proposer( monkeypatch.setattr(llm_base_proposer, "AttentionGroup", _FakeAttentionGroup) proposer = EagleProposer.__new__(EagleProposer) - proposer.vllm_config = None # type: ignore[assignment] # Patched backend discovery does not read config. + proposer.vllm_config = None proposer.device = None proposer._draft_attn_layer_names = set(layer_names) proposer.kv_cache_gid = -1 diff --git a/tests/v1/spec_decode/test_llm_base_proposer_sampling.py b/tests/v1/spec_decode/test_llm_base_proposer_sampling.py index 7531b8b6cd..cb390b992f 100644 --- a/tests/v1/spec_decode/test_llm_base_proposer_sampling.py +++ b/tests/v1/spec_decode/test_llm_base_proposer_sampling.py @@ -85,7 +85,7 @@ def test_compute_probs_and_sample_next_token_uses_fp64_exponential_race(): def test_mtp_model_returns_tuple(architecture: str, expected: bool): proposer = object.__new__(SpecDecodeBaseProposer) proposer.method = "mtp" - proposer.draft_model_config = SimpleNamespace( # type: ignore[assignment] # Architecture-only config. + proposer.draft_model_config = SimpleNamespace( hf_config=SimpleNamespace(architectures=[architecture]) ) diff --git a/tests/v1/spec_decode/test_rejection_sampler_utils.py b/tests/v1/spec_decode/test_rejection_sampler_utils.py index eb95dbdc61..7fc6898142 100644 --- a/tests/v1/spec_decode/test_rejection_sampler_utils.py +++ b/tests/v1/spec_decode/test_rejection_sampler_utils.py @@ -700,7 +700,7 @@ def test_verify_rejects_unproposed_drafts(): first_pos = inputs["pos"].view(num_trials, K + 1)[:, 0] prefill_len = first_pos + 1 rejection_sampler = object.__new__(RejectionSampler) - rejection_sampler.sampler = SimpleNamespace( # type: ignore[assignment] + rejection_sampler.sampler = SimpleNamespace( apply_sampling_params=lambda logits, *args: logits, sampling_states=SimpleNamespace( temperature=SimpleNamespace(gpu=inputs["temperature"]), diff --git a/tests/v1/structured_output/test_backend_xgrammar_lark.py b/tests/v1/structured_output/test_backend_xgrammar_lark.py index 9293b19296..cda9acf311 100644 --- a/tests/v1/structured_output/test_backend_xgrammar_lark.py +++ b/tests/v1/structured_output/test_backend_xgrammar_lark.py @@ -48,9 +48,9 @@ def _validate( ) -> StructuredOutputsParams: params = SamplingParams(structured_outputs=StructuredOutputsParams(grammar=grammar)) params._validate_structured_outputs( - _StubModelConfig(), # type: ignore[arg-type] + _StubModelConfig(), StructuredOutputsConfig(backend=backend), - tokenizer=tokenizer or object(), # type: ignore[arg-type] + tokenizer=tokenizer or object(), ) assert params.structured_outputs is not None return params.structured_outputs diff --git a/tests/v1/structured_output/test_backend_xgrammar_plamo3.py b/tests/v1/structured_output/test_backend_xgrammar_plamo3.py index 613daa5350..a6506dafaa 100644 --- a/tests/v1/structured_output/test_backend_xgrammar_plamo3.py +++ b/tests/v1/structured_output/test_backend_xgrammar_plamo3.py @@ -51,7 +51,7 @@ def make_vllm_config() -> VllmConfig: config = VllmConfig( structured_outputs_config=StructuredOutputsConfig(backend="xgrammar"), ) - config.model_config = SimpleNamespace( # type: ignore[assignment] + config.model_config = SimpleNamespace( hf_config=SimpleNamespace(model_type="plamo3") ) return config @@ -73,7 +73,7 @@ def test_plamo3_python_tokenizer_compiles_and_accepts_structural_tag(): tokenizer = Plamo3Tokenizer(["", *call_tokens]) backend = XgrammarBackend( make_vllm_config(), - tokenizer=tokenizer, # type: ignore[arg-type] + tokenizer=tokenizer, vocab_size=len(tokenizer.get_vocab()), ) tools = [ @@ -107,7 +107,7 @@ def test_plamo3_grammar_matches_decoded_bytes(value): tokenizer = Plamo3Tokenizer(list(dict.fromkeys(["", value, *pieces]))) backend = XgrammarBackend( make_vllm_config(), - tokenizer=tokenizer, # type: ignore[arg-type] + tokenizer=tokenizer, vocab_size=len(tokenizer.get_vocab()), ) for tokens in ([value], pieces): diff --git a/tests/v1/structured_output/test_structured_output_manager.py b/tests/v1/structured_output/test_structured_output_manager.py index 15239ecb76..6082bcd6a7 100644 --- a/tests/v1/structured_output/test_structured_output_manager.py +++ b/tests/v1/structured_output/test_structured_output_manager.py @@ -108,7 +108,7 @@ def _build_harness( ) manager = StructuredOutputManager(vllm_config) if use_reasoner: - manager.reasoner_cls = MockReasoner # type: ignore[assignment] + manager.reasoner_cls = MockReasoner sampling_params = SamplingParams( structured_outputs=structured_outputs diff --git a/tests/v1/structured_output/test_validation.py b/tests/v1/structured_output/test_validation.py index 2ce81534a4..767153cac7 100644 --- a/tests/v1/structured_output/test_validation.py +++ b/tests/v1/structured_output/test_validation.py @@ -35,7 +35,7 @@ def test_structured_outputs_rejected_for_diffusion_models(): ) with pytest.raises(VLLMValidationError, match="not yet supported for diffusion"): params._validate_structured_outputs( - _StubModelConfig(is_diffusion=True), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=True), StructuredOutputsConfig(), tokenizer=None, ) @@ -45,7 +45,7 @@ def test_plain_request_allowed_for_diffusion_models(): """Requests without structured outputs are unaffected by the guard.""" params = SamplingParams() params._validate_structured_outputs( - _StubModelConfig(is_diffusion=True), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=True), StructuredOutputsConfig(), tokenizer=None, ) @@ -71,9 +71,9 @@ def test_degenerate_structured_outputs_rejected(structured_outputs, match): params = SamplingParams(structured_outputs=structured_outputs) with pytest.raises(VLLMValidationError, match=match): params._validate_structured_outputs( - _StubModelConfig(is_diffusion=False), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=False), StructuredOutputsConfig(), - tokenizer=object(), # type: ignore[arg-type] + tokenizer=object(), ) @@ -97,9 +97,9 @@ def test_regex_with_nul_byte_rejected(regex): # (which would otherwise catch the error and fall back to another backend). with pytest.raises(VLLMValidationError, match="NUL"): params._validate_structured_outputs( - _StubModelConfig(is_diffusion=False), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=False), StructuredOutputsConfig(), - tokenizer=object(), # type: ignore[arg-type] + tokenizer=object(), ) # 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): params = SamplingParams(structured_outputs=structured_outputs) with pytest.raises(VLLMClientError): params._validate_structured_outputs( - _StubModelConfig(is_diffusion=False), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=False), StructuredOutputsConfig(backend=backend), - tokenizer=object(), # type: ignore[arg-type] + tokenizer=object(), ) @@ -180,9 +180,9 @@ def test_auto_backend_falls_back_on_unsupported_schema(schema, expected_backend) """`auto` falls back on rejection, so it must catch what the validators raise.""" params = SamplingParams(structured_outputs=StructuredOutputsParams(json=schema)) params._validate_structured_outputs( - _StubModelConfig(is_diffusion=False), # type: ignore[arg-type] + _StubModelConfig(is_diffusion=False), StructuredOutputsConfig(backend="auto"), - tokenizer=object(), # type: ignore[arg-type] + tokenizer=object(), ) assert params.structured_outputs is not None assert params.structured_outputs._backend == expected_backend diff --git a/tests/v1/worker/test_attn_utils.py b/tests/v1/worker/test_attn_utils.py index 73a0131915..2166141638 100644 --- a/tests/v1/worker/test_attn_utils.py +++ b/tests/v1/worker/test_attn_utils.py @@ -135,7 +135,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support(): _TargetBackend, ["target"], spec, - 0, # type: ignore[arg-type] + 0, ) target_group.metadata_builders = [ _FakeMetadataBuilder(AttentionCGSupport.ALWAYS) # type: ignore[list-item] @@ -144,7 +144,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support(): _DraftBackend, ["draft"], spec, - 0, # type: ignore[arg-type] + 0, ) draft_group.metadata_builders = [ _FakeMetadataBuilder(AttentionCGSupport.UNIFORM_BATCH) # type: ignore[list-item] @@ -152,14 +152,14 @@ def test_attention_checks_preserve_global_and_target_scoped_support(): groups = [[target_group, draft_group]] # The runner-wide execution mode must still honor the drafter's limit. - unfiltered = get_attn_cg_support(groups, None) # type: ignore[arg-type] + unfiltered = get_attn_cg_support(groups, None) assert unfiltered.min_cg_support == AttentionCGSupport.UNIFORM_BATCH assert unfiltered.min_cg_attn_backend == "_DraftBackend" # Adaptive verification validates only the target's varlen graphs. target_only = get_attn_cg_support( groups, - None, # type: ignore[arg-type] + None, checked_layer_names={"target"}, ) assert target_only.min_cg_support == AttentionCGSupport.ALWAYS @@ -176,7 +176,7 @@ def test_attention_checks_preserve_global_and_target_scoped_support(): draft_group.layer_names.append("target") target_with_shared_group = get_attn_cg_support( groups, - None, # type: ignore[arg-type] + None, checked_layer_names={"target"}, ) assert target_with_shared_group.min_cg_support == AttentionCGSupport.UNIFORM_BATCH diff --git a/tests/v1/worker/test_gpu_kv_connector.py b/tests/v1/worker/test_gpu_kv_connector.py index 5e56e8a317..c442c6fc59 100644 --- a/tests/v1/worker/test_gpu_kv_connector.py +++ b/tests/v1/worker/test_gpu_kv_connector.py @@ -39,9 +39,7 @@ def _make_connector( kv_role="kv_consumer", kv_buffer_device="cpu", ) - connector = ActiveKVConnector( # type: ignore[arg-type] - SimpleNamespace(kv_transfer_config=kv_config), {} - ) + connector = ActiveKVConnector(SimpleNamespace(kv_transfer_config=kv_config), {}) events.clear() return connector @@ -66,7 +64,7 @@ def test_load_start_phase( request_indices = torch.tensor([3, 1]) request_ids = ["first", "second"] attn_metadata = {"layer": object()} - connector.pre_forward( # type: ignore[arg-type] + connector.pre_forward( output, request_state_indices=request_indices, request_ids=request_ids, @@ -85,7 +83,7 @@ def test_load_start_phase( assert kwargs["attn_metadata"] is attn_metadata # A subsequent step without a forward must not reuse the prior batch. - connector.no_forward(_scheduler_output(False)) # type: ignore[arg-type] + connector.no_forward(_scheduler_output(False)) assert connector.kv_connector.start_load_kv.call_count == 2 assert connector.kv_connector.start_load_kv.call_args.kwargs == {} @@ -94,6 +92,6 @@ def test_no_forward_starts_deferred_load_once(monkeypatch: pytest.MonkeyPatch): events: list[str] = [] connector = _make_connector(monkeypatch, events) - connector.no_forward(_scheduler_output(False)) # type: ignore[arg-type] + connector.no_forward(_scheduler_output(False)) assert events == ["handle", "bind", "start", "wait", "clear"] diff --git a/tests/v1/worker/test_gpu_worker_weight_transfer.py b/tests/v1/worker/test_gpu_worker_weight_transfer.py index 537653bda3..49ef707894 100644 --- a/tests/v1/worker/test_gpu_worker_weight_transfer.py +++ b/tests/v1/worker/test_gpu_worker_weight_transfer.py @@ -75,7 +75,7 @@ def _make_worker(engine: _RecordingEngine | None) -> Worker: def test_reload_weights_sets_current_config(): worker = _make_worker(None) model_runner = _RecordingModelRunner() - worker.model_runner = model_runner # type: ignore[assignment] + worker.model_runner = model_runner Worker.reload_weights(worker) diff --git a/tests/v1/worker/test_late_interaction_runner.py b/tests/v1/worker/test_late_interaction_runner.py index 5f1b7cff37..054bfbdabd 100644 --- a/tests/v1/worker/test_late_interaction_runner.py +++ b/tests/v1/worker/test_late_interaction_runner.py @@ -142,7 +142,7 @@ def test_invalid_query_uses_raises(): mode=LATE_INTERACTION_MODE_CACHE_QUERY, query_key="query-bad", ) - bad_meta.query_uses = "bad-int" # type: ignore[assignment] + bad_meta.query_uses = "bad-int" bad_query_params = _make_pooling_params(bad_meta) with pytest.raises(ValueError, match="must be an integer value"):