code: def test_download_artifacts_awaits_download_completion(
      databricks_artifact_repo, tmp_path
  ):
      """
      Verifies that all asynchronous artifact downloads are joined before `download_artifacts()`
      returns a result to the caller
      """
  
      def mock_download_from_cloud(
          cloud_credential_info,  # pylint: disable=unused-argument
          dst_local_file_path,
      ):
          # Sleep in order to simulate a longer-running asynchronous download
          time.sleep(2)
          with open(dst_local_file_path, "w") as f:
              f.write("content")
  
      with mock.patch(
          f"{DATABRICKS_ARTIFACT_REPOSITORY}._get_read_credential_infos",
          return_value=[
              ArtifactCredentialInfo(
                  signed_uri=MOCK_AZURE_SIGNED_URI,
                  type=ArtifactCredentialType.AZURE_SAS_URI,
              ),
          ],
      ), mock.patch(
          f"{DATABRICKS_ARTIFACT_REPOSITORY}.list_artifacts",
          return_value=[
              FileInfo(path="file_1.txt", is_dir=False, file_size=100),
              FileInfo(path="file_2.txt", is_dir=False, file_size=0),
          ],
      ), mock.patch(
          f"{DATABRICKS_ARTIFACT_REPOSITORY}._download_from_cloud",
          side_effect=mock_download_from_cloud,
      ):
          databricks_artifact_repo.download_artifacts(
              "test_path", str(tmp_path)
          )
          expected_file1_path = os.path.join(
              str(tmp_path), "file_1.txt"
          )
          expected_file2_path = os.path.join(
              str(tmp_path), "file_2.txt"
          )
          for path in [expected_file1_path, expected_file2_path]:
              assert os.path.exists(path)
              with open(path) as f:
                  assert f.read() == "content"
  
imports: import json
  import os
  import posixpath
  import re
  import shutil
  import time
  from unittest import mock
  from unittest.mock import ANY
  import pytest
  from requests.models import Response
  from mlflow.entities.file_info import FileInfo
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialInfo, ArtifactCredentialType, CompleteMultipartUpload, CreateMultipartUpload, GetCredentialsForRead, GetCredentialsForWrite, GetPresignedUploadPartUrl
  from mlflow.protos.service_pb2 import FileInfo, ListArtifacts
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.databricks_artifact_repo import _MAX_CREDENTIALS_REQUEST_SIZE, DatabricksArtifactRepository
label_desc: Use image node_id 32 for calling a global function with example usage: test_download_artifacts_awaits_download_completion(databricks_artifact_repo, tmp_path) without return types