diff --git a/changelog/10337.bugfix.rst b/changelog/10337.bugfix.rst new file mode 100644 index 000000000..c5eeff19d --- /dev/null +++ b/changelog/10337.bugfix.rst @@ -0,0 +1,2 @@ +Fixed but that fake intermediate modules generated by ``--import-mode=importlib`` would not include the +child modules as attributes of the parent modules. diff --git a/testing/test_pathlib.py b/testing/test_pathlib.py index b9933353a..c15a81ea1 100644 --- a/testing/test_pathlib.py +++ b/testing/test_pathlib.py @@ -602,5 +602,5 @@ class TestImportLibMode: modules = {"xxx.tests.foo": ModuleType("xxx.tests.foo")} insert_missing_modules(modules, "xxx.tests.foo") assert sorted(modules) == ["xxx", "xxx.tests", "xxx.tests.foo"] - assert modules["xxx"].tests == modules["xxx.tests"] - assert modules["xxx.tests"].foo == modules["xxx.tests.foo"] + assert modules["xxx"].tests is modules["xxx.tests"] + assert modules["xxx.tests"].foo is modules["xxx.tests.foo"]