docstr: Tests removing checkpoint directories
docstr_tok: ["Tests","removing","checkpoint","directories"]
code: def test_delete_checkpoint(self) -> None:
      """
      Tests removing checkpoint directories
      """
      app_state = {"module": nn.Linear(2, 2)}
      with tempfile.TemporaryDirectory() as temp_dir:
          dirpath = os.path.join(temp_dir, "checkpoint")
          Snapshot.take(dirpath, app_state=app_state)
          self.assertTrue(os.path.exists(dirpath))
          # check that error is thrown if .snapshot_metadata is not found in the directory when deleting
          os.remove(os.path.join(dirpath, SNAPSHOT_METADATA_FNAME))
          with self.assertRaisesRegex(
              RuntimeError,
              f"{temp_dir} does not contain .snapshot_metadata",
          ):
              _delete_checkpoint(temp_dir, SNAPSHOT_METADATA_FNAME)
          _delete_checkpoint(dirpath)
          self.assertFalse(os.path.exists(dirpath))
  
imports: import os
  import shutil
  import tempfile
  import unittest
  import torch
  import torch.distributed
  from torch import nn
  from torch.distributed import launcher
  from torchsnapshot import Snapshot
  from torchsnapshot.snapshot import SNAPSHOT_METADATA_FNAME
  from torchtnt.framework._test_utils import DummyTrainUnit, get_dummy_train_state
  from torchtnt.framework.callbacks._checkpoint_utils import _delete_checkpoint, _metadata_exists, _prepare_app_state_for_checkpoint, _retrieve_checkpoint_dirpaths, get_checkpoint_dirpaths, get_latest_checkpoint_path, rank_zero_read_and_broadcast
  from torchtnt.utils.distributed import get_global_rank, PGWrapper
  from torchtnt.utils.env import init_from_env
  from torchtnt.utils.fsspec import get_filesystem
  from torchtnt.utils.test_utils import get_pet_launch_config, spawn_multi_process
label_desc: Use image node_id 9 for calling the CheckpointUtilsTest obj's underlying member method code with example usage: obj.test_delete_checkpoint() without return types