code: def test_hook_tracing(he_pm: PluginManager) -> None:
      saveindent = []
  
      class api1:
          @hookimpl
          def he_method1(self):
              saveindent.append(he_pm.trace.root.indent)
  
      class api2:
          @hookimpl
          def he_method1(self):
              saveindent.append(he_pm.trace.root.indent)
              raise ValueError()
  
      he_pm.register(api1())
      out: List[Any] = []
      he_pm.trace.root.setwriter(out.append)
      undo = he_pm.enable_tracing()
      try:
          indent = he_pm.trace.root.indent
          he_pm.hook.he_method1(arg=1)
          assert indent == he_pm.trace.root.indent
          assert len(out) == 2
          assert "he_method1" in out[0]
          assert "finish" in out[1]
  
          out[:] = []
          he_pm.register(api2())
  
          with pytest.raises(ValueError):
              he_pm.hook.he_method1(arg=1)
          assert he_pm.trace.root.indent == indent
          assert saveindent[0] > indent
      finally:
          undo()
  
imports: import sys
  from typing import Any
  from typing import List
  import pytest
  from pluggy import HookCallError
  from pluggy import HookimplMarker
  from pluggy import HookspecMarker
  from pluggy import PluginManager
  from pluggy import PluginValidationError
label_desc: Use image node_id 27 for calling a global function with example usage: test_hook_tracing(he_pm) without return types