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)
| 563 | |
| 564 | |
| 565 | def 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)) |
nothing calls this directly
no test coverage detected