code: def caplog(caplog):
      """Workaround for https://github.com/pytest-dev/pytest/issues/3697.
  
      Setting ``filterwarnings`` with pytest breaks ``caplog`` when ``not logger.propagate``.
  
      """
      import logging
  
      root_logger = logging.getLogger()
      root_propagate = root_logger.propagate
      root_logger.propagate = True
  
      propagation_dict = {
          name: logging.getLogger(name).propagate
          for name in logging.root.manager.loggerDict
          if name.startswith("lightning.pytorch")
      }
      for name in propagation_dict:
          logging.getLogger(name).propagate = True
  
      yield caplog
  
      root_logger.propagate = root_propagate
      for name, propagate in propagation_dict.items():
          logging.getLogger(name).propagate = propagate
  
imports: import os
  import signal
  import sys
  import threading
  from functools import partial
  from http.server import SimpleHTTPRequestHandler
  from pathlib import Path
  from typing import List
  from unittest.mock import Mock
  import lightning.fabric
  import lightning.pytorch
  import pytest
  import torch.distributed
  from lightning.fabric.plugins.environments.lightning import find_free_network_port
  from lightning.fabric.strategies.launchers.subprocess_script import _ChildProcessObserver
  from lightning.fabric.utilities.distributed import _distributed_is_initialized
  from lightning.fabric.utilities.imports import _IS_WINDOWS
  from lightning.pytorch.accelerators import XLAAccelerator
  from lightning.pytorch.trainer.connectors.signal_connector import _SignalConnector
  from tqdm import TMonitor
  from tests_pytorch import _PATH_DATASETS
label_desc: Use image node_id 20 for calling a global function with example usage: caplog(caplog) without return types