code: def test_mlflow_logger_dirs_creation(tmp_path):
      """Test that the logger creates the folders and files in the right place."""
      if not _MLFLOW_AVAILABLE:
          pytest.skip(
              "test for explicit file creation requires mlflow dependency to be installed."
          )
  
      assert not os.listdir(tmp_path)
      logger = MLFlowLogger("test", save_dir=str(tmp_path))
      assert logger.save_dir == str(tmp_path)
      assert set(os.listdir(tmp_path)) == {".trash"}
      run_id = logger.run_id
      exp_id = logger.experiment_id
  
      # multiple experiment calls should not lead to new experiment folders
      for i in range(2):
          _ = logger.experiment
          assert set(os.listdir(tmp_path)) == {".trash", exp_id}
          assert set(os.listdir(tmp_path / exp_id)) == {
              run_id,
              "meta.yaml",
          }
  
      class CustomModel(BoringModel):
          def on_train_epoch_end(self, *args, **kwargs):
              self.log("epoch", self.current_epoch)
  
      model = CustomModel()
      limit_batches = 5
      trainer = Trainer(
          default_root_dir=tmp_path,
          logger=logger,
          max_epochs=1,
          limit_train_batches=limit_batches,
          limit_val_batches=limit_batches,
      )
      trainer.fit(model)
      assert set(os.listdir(tmp_path / exp_id)) == {run_id, "meta.yaml"}
      assert "epoch" in os.listdir(
          tmp_path / exp_id / run_id / "metrics"
      )
      assert (
          set(os.listdir(tmp_path / exp_id / run_id / "params"))
          == model.hparams.keys()
      )
      assert trainer.checkpoint_callback.dirpath == str(
          tmp_path / exp_id / run_id / "checkpoints"
      )
      assert os.listdir(trainer.checkpoint_callback.dirpath) == [
          f"epoch=0-step={limit_batches}.ckpt"
      ]
  
imports: import os
  from unittest import mock
  from unittest.mock import MagicMock, Mock
  import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers.mlflow import _MLFLOW_AVAILABLE, MLFlowLogger, _get_resolve_tags
label_desc: Use image node_id 6 for calling a global function with example usage: test_mlflow_logger_dirs_creation(tmp_path) without return types