def test_no_meta_path_found(
        self,
        simple_module: Path,
        monkeypatch: MonkeyPatch,
        tmp_path: Path,
        ns_param: bool,
    ) -> None:
        """Even without any meta_path should still import module."""
        monkeypatch.setattr(sys, "meta_path", [])
        module = import_path(
            simple_module,
            mode="importlib",
            root=tmp_path,
            consider_namespace_packages=ns_param,
        )
        assert module.foo(2) == 42

        # mode='importlib' fails if no spec is found to load the module
        import importlib.util

        # Force module to be re-imported.
        del sys.modules[module.__name__]

        monkeypatch.setattr(
            importlib.util, "spec_from_file_location", lambda *args, **kwargs: None
        )
        with pytest.raises(ImportError):
            import_path(
                simple_module,
                mode="importlib",
                root=tmp_path,
                consider_namespace_packages=False,
            )
Even without any meta_path should still import module.
testing/test_pathlib.py