MCPcopy Index your code
hub / github.com/python/cpython / test_builtin__import__

Function test_builtin__import__

Lib/test/audit-tests.py:702–725  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700 )
701
702def test_builtin__import__():
703 import importlib # noqa: F401
704
705 with TestHook() as hook:
706 __import__("importlib")
707 __import__("email")
708 __import__("pythoninfo")
709 __import__("audit_test_data.submodule", level=1, globals={"__package__": "test"})
710 __import__("test.audit_test_data.submodule2")
711 __import__("_testcapi")
712
713 actual = [a for e, a in hook.seen if e == "import"]
714 assertSequenceEqual(
715 [
716 ("email", None, sys.path, sys.meta_path, sys.path_hooks),
717 ("pythoninfo", None, sys.path, sys.meta_path, sys.path_hooks),
718 ("test.audit_test_data.submodule", None, sys.path, sys.meta_path, sys.path_hooks),
719 ("test.audit_test_data", None, sys.path, sys.meta_path, sys.path_hooks),
720 ("test.audit_test_data.submodule2", None, sys.path, sys.meta_path, sys.path_hooks),
721 ("_testcapi", None, sys.path, sys.meta_path, sys.path_hooks),
722 ("_testcapi", unittest.mock.ANY, None, None, None)
723 ],
724 actual,
725 )
726
727def test_import_statement():
728 import importlib # noqa: F401

Callers

nothing calls this directly

Calls 3

__import__Function · 0.85
assertSequenceEqualFunction · 0.85
TestHookClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…