File tree Expand file tree Collapse file tree
Lib/test/test_lazy_import Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,11 +447,15 @@ def test_lazy_import_pkg(self):
447447
448448 def test_lazy_submodule_stored_in_parent_dict (self ):
449449 """Accessing a lazy submodule should store it in the parent's __dict__."""
450- import test .test_lazy_import .data .lazy_import_pkg
450+ out = io .StringIO ()
451+
452+ with contextlib .redirect_stdout (out ):
453+ import test .test_lazy_import .data .lazy_import_pkg
451454
452455 pkg = sys .modules ["test.test_lazy_import.data.pkg" ]
453456 self .assertIn ("bar" , pkg .__dict__ )
454457 self .assertIs (pkg .__dict__ ["bar" ], sys .modules ["test.test_lazy_import.data.pkg.bar" ])
458+ self .assertIn ("BAR_MODULE_LOADED" , out .getvalue ())
455459
456460 def test_lazy_import_pkg_cross_import (self ):
457461 """Cross-imports within package should preserve lazy imports."""
You can’t perform that action at this time.
0 commit comments