def METHOD_NAME(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()