()
| 675 | assertEqual(remote_event_script_path, tmp_file.name) |
| 676 | |
| 677 | def test_import_module(): |
| 678 | import importlib |
| 679 | |
| 680 | with TestHook() as hook: |
| 681 | importlib.import_module("importlib") # already imported, won't get logged |
| 682 | importlib.import_module("email") # standard library module |
| 683 | importlib.import_module("pythoninfo") # random module |
| 684 | importlib.import_module(".audit_test_data.submodule", "test") # relative import |
| 685 | importlib.import_module("test.audit_test_data.submodule2") # absolute import |
| 686 | importlib.import_module("_testcapi") # extension module |
| 687 | |
| 688 | actual = [a for e, a in hook.seen if e == "import"] |
| 689 | assertSequenceEqual( |
| 690 | [ |
| 691 | ("email", None, sys.path, sys.meta_path, sys.path_hooks), |
| 692 | ("pythoninfo", None, sys.path, sys.meta_path, sys.path_hooks), |
| 693 | ("test.audit_test_data.submodule", None, sys.path, sys.meta_path, sys.path_hooks), |
| 694 | ("test.audit_test_data", None, sys.path, sys.meta_path, sys.path_hooks), |
| 695 | ("test.audit_test_data.submodule2", None, sys.path, sys.meta_path, sys.path_hooks), |
| 696 | ("_testcapi", None, sys.path, sys.meta_path, sys.path_hooks), |
| 697 | ("_testcapi", unittest.mock.ANY, None, None, None) |
| 698 | ], |
| 699 | actual, |
| 700 | ) |
| 701 | |
| 702 | def test_builtin__import__(): |
| 703 | import importlib # noqa: F401 |
nothing calls this directly
no test coverage detected
searching dependent graphs…