Commit 28ae182
committed
Add comprehensive lazy import tests ported from internal test suite
Port missing test coverage from the internal lazy imports test suite to
cpython's test_lazy_import, covering behaviors not previously tested:
- Dict operations with lazy values (copy, |, update, values/items)
- from X import * resolution behavior with lazy imports
- Submodule laziness (unused submodules stay lazy, side effects)
- 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)
- Custom __import__ via exec with lazy imports
- Dict mutation during module loading
- Runtime enable/disable of lazy imports via sys.set_lazy_imports()
Adds supporting test data modules: metasyntactic package hierarchy,
versioned package, module_same_name_var_order packages, circular_import_pkg,
and cycle_with_load_global_pkg.1 parent 3a62c8f commit 28ae182
25 files changed
Lines changed: 911 additions & 0 deletions
File tree
- Lib/test/test_lazy_import
- data
- circular_import_pkg
- cycle_with_load_global_pkg
- metasyntactic
- foo
- ack
- bar
- baz
- qux
- thud
- plugh
- waldo
- fred
- module_same_name_var_order1
- module_same_name_var_order2
- versioned
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments