code: def test_add_tracefuncs(he_pm):
      out = []
  
      class api1(object):
          @hookimpl
          def he_method1(self):
              out.append("he_method1-api1")
  
      class api2(object):
          @hookimpl
          def he_method1(self):
              out.append("he_method1-api2")
  
      he_pm.register(api1())
      he_pm.register(api2())
  
      def before(hook_name, hook_impls, kwargs):
          out.append((hook_name, list(hook_impls), kwargs))
  
      def after(outcome, hook_name, hook_impls, kwargs):
          out.append((outcome, hook_name, list(hook_impls), kwargs))
  
      undo = he_pm.add_hookcall_monitoring(before, after)
  
      he_pm.hook.he_method1(arg=1)
      assert len(out) == 4
      assert out[0][0] == "he_method1"
      assert len(out[0][1]) == 2
      assert isinstance(out[0][2], dict)
      assert out[1] == "he_method1-api2"
      assert out[2] == "he_method1-api1"
      assert len(out[3]) == 4
      assert out[3][1] == out[0][0]
  
      undo()
      he_pm.hook.he_method1(arg=1)
      assert len(out) == 4 + 2
  
imports: import pytest
  import types
  from pluggy import PluginManager, PluginValidationError, HookCallError, HookimplMarker, HookspecMarker
  from pluggy.manager import importlib_metadata
label_desc: Use image node_id 22 for calling a global function with example usage: test_add_tracefuncs(he_pm) without return types