Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(tests): set exc.name on blocker's ModuleNotFoundError to match Python import machinery

KaifAhmad1c7edba88ea66
diff --git a/tests/ingest/test_optional_imports.py b/tests/ingest/test_optional_imports.py
index 9f629edb..d34b4d80 100644
--- a/tests/ingest/test_optional_imports.py
+++ b/tests/ingest/test_optional_imports.py
@@ -23,7 +23,9 @@ class OptionalDependencyBlocker(importlib.abc.MetaPathFinder):
def find_spec(self, fullname, path=None, target=None):
root_name = fullname.split(".", 1)[0]
if root_name in BLOCKED_MODULES:
- raise ModuleNotFoundError(f"No module named '{{root_name}}'")
+ err = ModuleNotFoundError(f"No module named '{{root_name}}'")
+ err.name = root_name
+ raise err
return None