From 675ec59aa94301989c3c174b3b910338c2d51ff4 Mon Sep 17 00:00:00 2001 From: Yanwen Lin Date: Wed, 25 Feb 2026 00:36:15 -0800 Subject: [PATCH] [Bugfix][CPU] Fix basic unit tests failing in CPU platforms (#34677) Signed-off-by: Yanwen Lin Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- tests/test_config.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 6e2a596611..0abfef76fb 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -926,12 +926,17 @@ def test_vllm_config_defaults(model_id, compiliation_config, optimization_level) # Verify other compilation_config defaults compilation_config_dict = default_config["compilation_config"] for k, v in compilation_config_dict.items(): - if k != "pass_config": - actual = getattr(vllm_config.compilation_config, k) - expected = v(vllm_config) if callable(v) else v - assert actual == expected, ( - f"compilation_config.{k}: expected {expected}, got {actual}" - ) + if k == "pass_config": + continue + actual = getattr(vllm_config.compilation_config, k) + expected = v(vllm_config) if callable(v) else v + # On platforms without static graph support, __post_init__ forces + # cudagraph_mode to NONE; expect that instead of the level default. + if k == "cudagraph_mode" and not current_platform.support_static_graph_mode(): + expected = CUDAGraphMode.NONE + assert actual == expected, ( + f"compilation_config.{k}: expected {expected}, got {actual}" + ) def test_vllm_config_callable_defaults(): @@ -969,6 +974,10 @@ def test_vllm_config_callable_defaults(): assert enable_if_sequential(config_quantized) is True +@pytest.mark.skipif( + not current_platform.support_static_graph_mode(), + reason="Explicit overrides may be force-overwritten without static graph support.", +) def test_vllm_config_explicit_overrides(): """Test that explicit property overrides work correctly with callable defaults.