Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions tests/utils_/test_import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,42 +83,6 @@ def test_returns_false_when_find_spec_succeeds_but_import_fails(self):
):
assert _has_module("fake_native_ext") is False

def test_returns_false_on_os_error_during_import(self):
"""Some shared-library failures surface as ``OSError``."""
fake_spec = MagicMock()

with (
patch(
"vllm.utils.import_utils.importlib.util.find_spec",
return_value=fake_spec,
),
patch(
"vllm.utils.import_utils.importlib.import_module",
side_effect=OSError("cannot load library"),
),
):
assert _has_module("fake_native_ext_os") is False

def test_returns_false_on_unexpected_error_during_import(self):
"""A broken extension may raise a non-import error (e.g. ``RuntimeError``).

Such modules are not usable, so ``_has_module`` should still return
``False`` rather than letting the exception propagate.
"""
fake_spec = MagicMock()

with (
patch(
"vllm.utils.import_utils.importlib.util.find_spec",
return_value=fake_spec,
),
patch(
"vllm.utils.import_utils.importlib.import_module",
side_effect=RuntimeError("CUDA driver version is insufficient"),
),
):
assert _has_module("fake_broken_ext") is False

def test_returns_false_when_find_spec_raises(self):
"""``find_spec`` itself can raise for dotted names whose parent package
fails to import. This should be treated as the module being unavailable.
Expand Down
Loading