code: def test_setters(monkeypatch, caplog):
      # pretend mpi4py is available
      monkeypatch.setattr(
          lightning.fabric.plugins.environments.mpi,
          "_MPI4PY_AVAILABLE",
          True,
      )
      mpi4py_mock = MagicMock()
  
      with mock.patch.dict("sys.modules", {"mpi4py": mpi4py_mock}):
          env = MPIEnvironment()
  
      # setter should be no-op
      with caplog.at_level(
          logging.DEBUG, logger="lightning.fabric.plugins.environments"
      ):
          env.set_global_rank(100)
      assert "setting global rank is not allowed" in caplog.text
  
      caplog.clear()
  
      with caplog.at_level(
          logging.DEBUG, logger="lightning.fabric.plugins.environments"
      ):
          env.set_world_size(100)
      assert "setting world size is not allowed" in caplog.text
  
file_path: pytorch-lightning/tests/tests_fabric/plugins/environments/test_mpi.py
imports: import logging
  import os
  from unittest import mock
  from unittest.mock import MagicMock
  import lightning.fabric.plugins.environments.mpi
  import pytest
  from lightning.fabric.plugins.environments import MPIEnvironment
label_desc: Use image node_id 6 for calling a global function with example usage: test_setters(monkeypatch, caplog) without return types