code: def test_srun_available_and_not_used(monkeypatch):
      """Test that a warning is emitted if Lightning suspects the user forgot to run their script with `srun`."""
      monkeypatch.setattr(sys, "argv", ["train.py", "--lr", "0.01"])
      expected = "`srun` .* available .* but is not used. HINT: .* srun python train.py --lr 0.01"
  
      # pretend `srun` is available
      with mock.patch(
          "lightning.fabric.plugins.environments.slurm.shutil.which",
          return_value="/usr/bin/srun",
      ):
          with pytest.warns(PossibleUserWarning, match=expected):
              SLURMEnvironment()
  
          with pytest.warns(PossibleUserWarning, match=expected):
              SLURMEnvironment.detect()
  
      # no warning if `srun` is unavailable
      with no_warning_call(PossibleUserWarning, match=expected):
          SLURMEnvironment()
          assert not SLURMEnvironment.detect()
  
file_path: pytorch-lightning/tests/tests_fabric/plugins/environments/test_slurm.py
imports: import logging
  import os
  import shutil
  import sys
  from unittest import mock
  import pytest
  from lightning.fabric.plugins.environments import SLURMEnvironment
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning_utilities.test.warning import no_warning_call
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 6 for calling a global function with example usage: test_srun_available_and_not_used(monkeypatch) without return types