code: def test_artifacts_tracker(tmpdir):
      work = ScriptRunner(
          root_path=os.path.dirname(__file__), script_path=__file__
      )
      tracker = PLAppArtifactsTracker(work=work)
      trainer = Mock()
  
      trainer.loggers = []
      trainer.default_root_dir = "default_root_dir"
      tracker.setup(trainer=trainer, pl_module=Mock())
      assert work.log_dir == Path("default_root_dir")
      assert not work.logger_metadatas
  
      trainer.loggers = [TensorBoardLogger(save_dir=tmpdir)]
      trainer.logger = trainer.loggers[0]
      tracker.setup(trainer=trainer, pl_module=Mock())
      assert work.log_dir == Path(
          tmpdir / "lightning_logs" / "version_0"
      )
      assert len(work.logger_metadatas) == 1
      assert work.logger_metadatas[0] == {
          "class_name": "TensorBoardLogger"
      }
  
      # call setup a second time and the metadata length should not change
      tracker.setup(trainer=trainer, pl_module=Mock())
      assert len(work.logger_metadatas) == 1
  
file_path: pytorch-lightning/src/lightning/app/cli/pl-app-template/tests/core/test_callbacks.py
imports: import os.path
  from unittest.mock import Mock
  import pytest
  from core.callbacks import PLAppArtifactsTracker, PLAppProgressTracker, PLAppSummary
  from core.components.script_runner import ScriptRunner
  from lightning.app.storage.path import Path
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.loggers import TensorBoardLogger
label_desc: Use image node_id 3 for calling a global function with example usage: test_artifacts_tracker(tmpdir) without return types