code: def test_check_for_bad_cuda_fork(mp_mock, _, start_method):
      mp_mock.get_all_start_methods.return_value = [start_method]
      launcher = _MultiProcessingLauncher(
          strategy=Mock(), start_method=start_method
      )
      with pytest.raises(
          RuntimeError,
          match="Lightning can't create new processes if CUDA is already initialized",
      ):
          launcher.launch(function=Mock())
  
file_path: pytorch-lightning/tests/tests_fabric/strategies/launchers/test_multiprocessing.py
imports: from unittest import mock
  from unittest.mock import ANY, Mock
  import pytest
  import torch
  from lightning.fabric.strategies.launchers.multiprocessing import _GlobalStateSnapshot, _MultiProcessingLauncher
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 6 for calling a global function with example usage: test_check_for_bad_cuda_fork(mp_mock, _, start_method) without return types