code: def test_persist_current_checkpoint(
      storage: StorageContext, tmp_path
  ):
      # Uploading a non-existent checkpoint directory should fail
      with pytest.raises(FileNotFoundError):
          storage.persist_current_checkpoint(
              Checkpoint.from_directory("/tmp/nonexistent/checkpoint")
          )
  
      # Uploading an empty checkpoint directory
      (tmp_path / "empty").mkdir()
      storage.persist_current_checkpoint(
          Checkpoint.from_directory(tmp_path / "empty")
      )
      assert (
          _list_at_fs_path(
              storage.storage_filesystem, storage.checkpoint_fs_path
          )
          == []
      )
  
      # Normal use case: Uploading an checkpoint directory with files
      (tmp_path / "regular").mkdir()
      (tmp_path / "regular" / "1.txt").touch()
      storage.persist_current_checkpoint(
          Checkpoint.from_directory(tmp_path / "regular")
      )
      assert _list_at_fs_path(
          storage.storage_filesystem, storage.checkpoint_fs_path
      ) == ["1.txt"]
  
      storage.current_checkpoint_index += 1
  
      # Persisting a checkpoint that is already at the correct path (for local fs case)
      if isinstance(
          storage.storage_filesystem, pyarrow.fs.LocalFileSystem
      ):
          final_checkpoint_dir = Path(storage.checkpoint_fs_path)
          final_checkpoint_dir.mkdir(parents=True)
          (final_checkpoint_dir / "2.txt").touch()
          storage.persist_current_checkpoint(
              Checkpoint.from_directory(final_checkpoint_dir)
          )
  
file_path: ray/python/ray/train/tests/test_storage.py
imports: import os
  from pathlib import Path
  import pyarrow.fs
  import pytest
  import ray.cloudpickle
  from ray.train import Checkpoint, SyncConfig
  from ray.train._internal.storage import _VALIDATE_STORAGE_MARKER_FILENAME, StorageContext, _list_at_fs_path
  from ray.train.tests.test_new_persistence import _resolve_storage_type
label_desc: Use image node_id 7 for calling a global function with example usage: test_persist_current_checkpoint(storage, tmp_path) without return types