MCPcopy Create free account
hub / github.com/alibaba/zvec / test_require_module_submodule_import_error

Function test_require_module_submodule_import_error

python/tests/test_util.py:58–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56
57
58def test_require_module_submodule_import_error():
59 with pytest.raises(ImportError) as exc_info:
60 require_module("os.nonexistent_submodule")
61
62 exception_msg = str(exc_info.value)
63 assert (
64 "Required package 'os.nonexistent_submodule' is not installed." in exception_msg
65 )
66 assert "Module 'os.nonexistent_submodule' is part of 'os'" in exception_msg
67 assert "please pip install 'os'." in exception_msg
68
69
70@patch("importlib.import_module")

Callers

nothing calls this directly

Calls 1

require_moduleFunction · 0.90

Tested by

no test coverage detected