Skip to content

gh-149640: Add additional tests for Lazy Imports#149739

Draft
brittanyrey wants to merge 2 commits into
python:mainfrom
brittanyrey:add-lazy-import-tests
Draft

gh-149640: Add additional tests for Lazy Imports#149739
brittanyrey wants to merge 2 commits into
python:mainfrom
brittanyrey:add-lazy-import-tests

Conversation

@brittanyrey
Copy link
Copy Markdown
Contributor

@brittanyrey brittanyrey commented May 12, 2026

We had a lot of Lazy Import tests in the Cinder/MetaPython Lazy Imports test suite that should also be useful for Cpython. Porting some tests over to increase coverage--especially around lazy_imports=all.

Adds supporting test data modules.

#149640

@brittanyrey brittanyrey force-pushed the add-lazy-import-tests branch from 28ae182 to 15f157e Compare May 12, 2026 17:53
Port missing test coverage from the internal lazy imports test suite,
covering behaviors not previously tested in cpython:

- Dict operations with lazy values (copy, |, update preserve proxies)
- Submodule laziness (unaccessed imports stay lazy until touched)
- Attribute side effects (submodule imports don't overwrite parent attrs)
- Module/variable name collisions (submodule vs variable ordering)
- Deleted module reimport (sys.modules deletion and reimport)
- Circular import resolution (lazy imports breaking circular deadlocks)
- Dict mutation during module loading (no crash on dict resize)

Adds supporting test data modules: metasyntactic package hierarchy,
versioned package, module_same_name_var_order packages, and
circular_import_pkg.
@brittanyrey brittanyrey force-pushed the add-lazy-import-tests branch from 15f157e to 4f945a4 Compare May 22, 2026 16:05
@brittanyrey brittanyrey changed the title PEP 810: Add comprehensive Lazy Import tests ported from Cinder test suite Add additional tests for Lazy Imports May 22, 2026
@brittanyrey brittanyrey changed the title Add additional tests for Lazy Imports gh-149640: Add additional tests for Lazy Imports May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant