code: def test_with_callbacks_immediately_executed(
      pm: PluginManager,
  ) -> None:
      class Hooks:
          @hookspec(historic=True)
          def he_method1(self, arg):
              pass
  
      pm.add_hookspecs(Hooks)
  
      class Plugin1:
          @hookimpl
          def he_method1(self, arg):
              return arg * 10
  
      class Plugin2:
          @hookimpl
          def he_method1(self, arg):
              return arg * 20
  
      class Plugin3:
          @hookimpl
          def he_method1(self, arg):
              return arg * 30
  
      out = []
      pm.register(Plugin1())
      pm.register(Plugin2())
  
      he_method1 = pm.hook.he_method1
      he_method1.call_historic(lambda res: out.append(res), dict(arg=1))
      assert out == [20, 10]
      pm.register(Plugin3())
      assert out == [20, 10, 30]
  
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 16 for calling a global function with example usage: test_with_callbacks_immediately_executed(pm) and returns: unknown, unknown, unknown