code: def test_syspath_prepend_with_namespace_packages(
      pytester: Pytester, monkeypatch: MonkeyPatch
  ) -> None:
      for dirname in "hello", "world":
          d = pytester.mkdir(dirname)
          ns = d.joinpath("ns_pkg")
          ns.mkdir()
          ns.joinpath("__init__.py").write_text(
              "__import__('pkg_resources').declare_namespace(__name__)",
              encoding="utf-8",
          )
          lib = ns.joinpath(dirname)
          lib.mkdir()
          lib.joinpath("__init__.py").write_text(
              "def check(): return %r" % dirname, encoding="utf-8"
          )
  
      monkeypatch.syspath_prepend("hello")
      import ns_pkg.hello
  
      assert ns_pkg.hello.check() == "hello"
  
      with pytest.raises(ImportError):
          import ns_pkg.world
  
      # Prepending should call fixup_namespace_packages.
      monkeypatch.syspath_prepend("world")
      import ns_pkg.world
  
      assert ns_pkg.world.check() == "world"
  
      # Should invalidate caches via importlib.invalidate_caches.
      modules_tmpdir = pytester.mkdir("modules_tmpdir")
      monkeypatch.syspath_prepend(str(modules_tmpdir))
      modules_tmpdir.joinpath("main_app.py").write_text(
          "app = True", encoding="utf-8"
      )
      from main_app import app
  
imports: import os
  import re
  import sys
  import textwrap
  from pathlib import Path
  from typing import Dict
  from typing import Generator
  from typing import Type
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
label_desc: Use image node_id 25 for calling a global function with example usage: test_syspath_prepend_with_namespace_packages(pytester, monkeypatch) without return types