code: def test_load_call_unload_extensions_python_module_path(extension1):
      """
      Load, run, unload an extension that was loaded using a python module
      path (as would be used by an import statement) instead of a file path.
      """
      from cugraph_service_client.exceptions import CugraphServiceError
      from cugraph_service_server.cugraph_handler import CugraphHandler
  
      handler = CugraphHandler()
      extension_dir = extension1
      extension_dir_path = Path(extension_dir).absolute()
      package_name = (
          extension_dir_path.name
      )  # last name in the path only
  
      # Create an __init__py file and add the dir to sys.path so it can be
      # imported as a package.
      with open(extension_dir_path / "__init__.py", "w") as f:
          f.write("")
      # FIXME: this should go into a fixture which can unmodify sys.path when done
      sys.path.append(extension_dir_path.parent.as_posix())
  
      # Create another .py file to test multiple module loading
      with open(extension_dir_path / "foo.py", "w") as f:
          f.write("def foo_func(): return 33")
  
      # Load everything in the package, ext_mod_names should be a list of python
      # files containing 3 files (2 modules + __init__.py file).
      # Assume the .py file in the generated extension dir is named
      # "my_extension.py"
      ext_mod_names1 = handler.load_extensions(package_name)
      assert len(ext_mod_names1) == 3
      assert (
          str(extension_dir_path / "my_extension.py") in ext_mod_names1
      )
      assert str(extension_dir_path / "foo.py") in ext_mod_names1
      assert str(extension_dir_path / "__init__.py") in ext_mod_names1
  
      results = handler.call_extension(
          "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
      )
      assert results.list_value[0].list_value[0].int32_value == 9
      assert results.list_value[1].list_value[0].double_value == 9.0
  
      result = handler.call_extension("foo_func", "()", "{}")
      assert result.int32_value == 33
  
      # unload
      for mod_name in ext_mod_names1:
          handler.unload_extension_module(mod_name)
  
      with pytest.raises(CugraphServiceError):
          handler.call_extension(
              "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
          )
      with pytest.raises(CugraphServiceError):
          handler.call_extension("foo_func", "()", "{}")
  
      # Load just an individual module in the package, ext_mod_names should only
      # contain 1 file.
      mod_name = f"{package_name}.my_extension"
      ext_mod_names2 = handler.load_extensions(mod_name)
      assert ext_mod_names2 == [
          str(extension_dir_path / "my_extension.py")
      ]
  
      results = handler.call_extension(
          "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
      )
      assert results.list_value[0].list_value[0].int32_value == 9
      assert results.list_value[1].list_value[0].double_value == 9.0
  
      for mod_name in ext_mod_names2:
          handler.unload_extension_module(mod_name)
  
      with pytest.raises(CugraphServiceError):
          handler.call_extension(
              "my_nines_function", "(33, 'int32', 21, 'float64')", "{}"
          )
  
file_path: cugraph/python/cugraph-service/tests/test_cugraph_handler.py
imports: import sys
  import pickle
  from pathlib import Path
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_load_call_unload_extensions_python_module_path(extension1) without return types