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

Function test_require_module_with_mitigation_import_error

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

Source from the content-addressed store, hash-verified

43
44
45def test_require_module_with_mitigation_import_error():
46 with pytest.raises(ImportError) as exc_info:
47 require_module("nonexistent_module.submodule", mitigation="custom_package")
48
49 exception_msg = str(exc_info.value)
50 assert "Required package 'custom_package' is not installed." in exception_msg
51 assert (
52 "Module 'nonexistent_module.submodule' is part of 'nonexistent_module'"
53 in exception_msg
54 )
55 assert "please pip install 'custom_package'." in exception_msg
56
57
58def test_require_module_submodule_import_error():

Callers

nothing calls this directly

Calls 1

require_moduleFunction · 0.90

Tested by

no test coverage detected