code: def test_context_meter_raise():
      it = iter([123, 124])
      cbs = []
  
      with pytest.raises(ValueError):
          with metrics.context_meter.add_callback(
              lambda l, v, u: cbs.append((l, v, u))
          ):
              with metrics.context_meter.meter(
                  "m1", func=lambda: next(it)
              ) as m:
                  raise ValueError()
  
      # Not recorded - out of context
      metrics.context_meter.digest_metric("m1", 123, "foo")
  
      assert m.start == 123
      assert m.stop == 124
      assert m.delta == 1
      assert cbs == [("m1", 1, "seconds")]
  
imports: from __future__ import annotations
  import math
  import pickle
  import threading
  import time
  import pytest
  from distributed import metrics
  from distributed.compatibility import WINDOWS
  from distributed.utils import offload
  from distributed.utils_test import gen_test
label_desc: Use image node_id 7 for calling a global function with example usage: test_context_meter_raise() without return types