code: def test_wrapper_exception_chaining() -> None:
      @hookimpl
      def m1():
          raise Exception("m1")
  
      @hookimpl(wrapper=True)
      def m2():
          try:
              yield
          except Exception:
              raise Exception("m2")
  
      @hookimpl(wrapper=True)
      def m3():
          yield
          return 10
  
      @hookimpl(wrapper=True)
      def m4():
          try:
              yield
          except Exception as e:
              raise Exception("m4") from e
  
      with pytest.raises(Exception) as excinfo:
          MC([m1, m2, m3, m4], {})
      assert str(excinfo.value) == "m4"
      assert excinfo.value.__cause__ is not None
      assert str(excinfo.value.__cause__) == "m2"
      assert excinfo.value.__cause__.__context__ is not None
      assert str(excinfo.value.__cause__.__context__) == "m1"
  
imports: from typing import Callable
  from typing import List
  from typing import Mapping
  from typing import Sequence
  from typing import Type
  from typing import Union
  import pytest
  from pluggy import HookCallError
  from pluggy import HookimplMarker
  from pluggy import HookspecMarker
  from pluggy._callers import _multicall
  from pluggy._hooks import HookImpl
label_desc: Use image node_id 19 for calling a global function with example usage: test_wrapper_exception_chaining() and returns: int