code: def test_iter_importers(self):
      iter_importers = pkgutil.iter_importers
      get_importer = pkgutil.get_importer
  
      pkgname = "spam"
      modname = "eggs"
      dirname = self.create_init(pkgname)
      pathitem = os.path.join(dirname, pkgname)
      fullname = "{}.{}".format(pkgname, modname)
      sys.modules.pop(fullname, None)
      sys.modules.pop(pkgname, None)
      try:
          self.create_submodule(dirname, pkgname, modname, 0)
  
          importlib.import_module(fullname)
  
          importers = list(iter_importers(fullname))
          expected_importer = get_importer(pathitem)
          for finder in importers:
              spec = finder.find_spec(fullname)
              loader = spec.loader
              try:
                  loader = loader.loader
              except AttributeError:
                  # For now we still allow raw loaders from
                  # find_module().
                  pass
              self.assertIsInstance(
                  finder, importlib.machinery.FileFinder
              )
              self.assertEqual(finder, expected_importer)
              self.assertIsInstance(
                  loader, importlib.machinery.SourceFileLoader
              )
              self.assertIsNone(finder.find_spec(pkgname))
  
          with self.assertRaises(ImportError):
              list(iter_importers("invalid.module"))
  
          with self.assertRaises(ImportError):
              list(iter_importers(".spam"))
      finally:
          shutil.rmtree(dirname)
          del sys.path[0]
          try:
              del sys.modules["spam"]
              del sys.modules["spam.eggs"]
          except KeyError:
              pass
  
imports: from pathlib import Path
  from test.support.import_helper import unload, CleanImport
  from test.support.warnings_helper import check_warnings, ignore_warnings
  import unittest
  import sys
  import importlib
  from importlib.util import spec_from_file_location
  import pkgutil
  import os
  import os.path
  import tempfile
  import shutil
  import zipfile
label_desc: Use image node_id 4 for calling the ExtendPathTests obj's underlying member method code with example usage: obj.test_iter_importers() without return types