code: def test_dependencies(monkeypatch):
      """Test that the MPI environment requires the `mpi4py` package."""
      monkeypatch.setattr(
          lightning.fabric.plugins.environments.mpi,
          "_MPI4PY_AVAILABLE",
          False,
      )
      with pytest.raises(ModuleNotFoundError):
          MPIEnvironment()
  
      # pretend mpi4py is available
      monkeypatch.setattr(
          lightning.fabric.plugins.environments.mpi,
          "_MPI4PY_AVAILABLE",
          True,
      )
      with mock.patch.dict("sys.modules", {"mpi4py": MagicMock()}):
          MPIEnvironment()
  
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 1 for calling a global function with example usage: test_dependencies(monkeypatch) without return types