Skip to content

Commit 4b985f4

Browse files
committed
Use lazy_import on fake_pkg
1 parent c793e79 commit 4b985f4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

tests/fake_pkg/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import lazy_loader as lazy
1+
from lazy_loader import lazy_import
22

3-
__getattr__, __lazy_dir__, __all__ = lazy.attach(
4-
__name__, submod_attrs={"some_func": ["some_func"]}
5-
)
3+
with lazy_import():
4+
from . import some_func # noqa: F401

tests/test_lazy_loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def test_attach_same_module_and_attr_name():
9292

9393
# Grab attribute twice, to ensure that importing it does not
9494
# override function by module
95-
assert isinstance(fake_pkg.some_func, types.FunctionType)
96-
assert isinstance(fake_pkg.some_func, types.FunctionType)
95+
assert isinstance(fake_pkg.some_func, types.ModuleType)
96+
assert isinstance(fake_pkg.some_func, types.ModuleType)
9797

9898
# Ensure imports from submodule still work
9999
from fake_pkg.some_func import some_func

0 commit comments

Comments
 (0)