def test_remembers_previous_imports(
        self, simple_module: Path, tmp_path: Path, ns_param: bool
    ) -> None:
        """`importlib` mode called remembers previous module (#10341, #10811)."""
        module1 = import_path(
            simple_module,
            mode="importlib",
            root=tmp_path,
            consider_namespace_packages=ns_param,
        )
        module2 = import_path(
            simple_module,
            mode="importlib",
            root=tmp_path,
            consider_namespace_packages=ns_param,
        )
        assert module1 is module2
`importlib` mode called remembers previous module (#10341, #10811).
testing/test_pathlib.py