code: def test_inductor_error(self, records):
      exitstack = contextlib.ExitStack()
      import torch._inductor.lowering
  
      def throw(x):
          raise AssertionError()
  
      # inject an error in the lowerings
      dict_entries = {}
      for x in list(torch._inductor.lowering.lowerings.keys()):
          if "round" in x.__name__:
              dict_entries[x] = throw
  
      exitstack.enter_context(
          unittest.mock.patch.dict(
              torch._inductor.lowering.lowerings, dict_entries
          )
      )
  
      try:
          fn_opt = torch._dynamo.optimize("inductor")(inductor_error_fn)
          fn_opt(*ARGS)
      except Exception:
          pass
      record = self.getRecord(records, "WON'T CONVERT")
      self.assertExpectedInline(
          munge_exc(record.getMessage()),
          """\
  WON'T CONVERT inductor_error_fn test_logging.py line N
  due to:
  Traceback (most recent call last):
    File "test_logging.py", line N, in throw
      raise AssertionError()
  torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
  LoweringException: AssertionError:
    target: aten.round.default
    args[0]: TensorBox(StorageBox(
      InputBuffer(name='primals_1', layout=FixedLayout('cpu', torch.float32, size=[1000, 1000], stride=[1000, 1]))
    ))""",
      )
  
      exitstack.close()
  
imports: import atexit
  import contextlib
  import functools
  import logging
  import os
  import re
  import unittest.mock
  import torch
  import torch._dynamo.test_case
  import torch._dynamo.testing
  import torch.distributed
  from torch._dynamo.testing import skipIfNotPy311
  from torch.nn.parallel import DistributedDataParallel
  from torch.testing._internal.common_utils import find_free_port, munge_exc
  from torch.testing._internal.inductor_utils import HAS_CUDA
  from torch.testing._internal.logging_utils import LoggingTestCase, make_logging_test, make_settings_test
label_desc: Use image node_id 6 for calling the LoggingTests obj's underlying member method code with example usage: obj.test_inductor_error(records) without return types