MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / test_get_fullname

Function test_get_fullname

tests_python/test_convert_utilities.py:565–593  ·  view source on GitHub ↗

Test that get_fullname correctly resolves module names to file paths. This is a regression test for the fix that replaced pkgutil.get_loader (removed in Python 3.14) with importlib.util.find_spec.

(tmp_path)

Source from the content-addressed store, hash-verified

563
564
565def test_get_fullname(tmp_path):
566 """Test that get_fullname correctly resolves module names to file paths.
567
568 This is a regression test for the fix that replaced pkgutil.get_loader
569 (removed in Python 3.14) with importlib.util.find_spec.
570 """
571 from pydevd_file_utils import get_fullname
572
573 # Create a temporary module file
574 mod_file = tmp_path / "my_test_mod.py"
575 mod_file.write_text("x = 1\n")
576
577 # Add tmp_path to sys.path so the module can be found
578 sys.path.insert(0, str(tmp_path))
579 try:
580 result = get_fullname("my_test_mod")
581 assert result is not None
582 assert result.endswith("my_test_mod.py")
583
584 # Non-existent module should return None
585 result = get_fullname("nonexistent_module_xyz_12345")
586 assert result is None
587
588 # A stdlib package with __init__.py should be found
589 result = get_fullname("json")
590 assert result is not None
591 assert result.endswith("__init__.py")
592 finally:
593 sys.path.remove(str(tmp_path))

Callers

nothing calls this directly

Calls 2

get_fullnameFunction · 0.90
removeMethod · 0.45

Tested by

no test coverage detected