Skip to content

gh-149013: extend test_lazy_import coverage for reload() and sys.modu…#149014

Open
XiaoWan-zi wants to merge 2 commits intopython:mainfrom
XiaoWan-zi:add_two_tests_to_lazy_import
Open

gh-149013: extend test_lazy_import coverage for reload() and sys.modu…#149014
XiaoWan-zi wants to merge 2 commits intopython:mainfrom
XiaoWan-zi:add_two_tests_to_lazy_import

Conversation

@XiaoWan-zi
Copy link
Copy Markdown
Contributor

@XiaoWan-zi XiaoWan-zi commented Apr 26, 2026

Summary

Add two tests to test_lazy_import covering post-reification import state transitions:

  • test_reload_after_lazy_reification_keeps_single_module_object
  • test_reimport_after_deleting_sys_modules_entry_creates_new_module

Details

  • Verify importlib.reload() behavior after lazy reification.
  • Verify behavior after removing sys.modules["json"]:
    • existing binding remains usable,
    • a later explicit import creates and caches a new module object.

Files

  • Lib/test/test_lazy_import/__init__.py

Test

  • ./python -m test test_lazy_import

Notes

Test-only change; no interpreter behavior changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant