code: def make_settings_test(settings):
      def wrapper(fn):
          def test_fn(self):
              torch._dynamo.reset()
              records = []
              # run with env var
              with log_settings(settings), self._handler_watcher(
                  records
              ):
                  fn(self, records)
  
          return test_fn
  
      return wrapper
  
file_path: pytorch/torch/testing/_internal/logging_utils.py
imports: import torch._dynamo.test_case
  import unittest.mock
  import os
  import contextlib
  import torch._logging
  import torch._logging._internal
  from torch._dynamo.utils import LazyString
  import logging
label_desc: Use image node_id 6 for calling a global function with example usage: make_settings_test(settings) and returns: wrapper, test_fn