code: def test_path_parameter():
      """
      Tests that MLflow file-download APIs get called when necessary for arguments of type `path`.
      """
      project = load_project()
      entry_point = project.get_entry_point("line_count")
      with mock.patch(
          "mlflow.tracking.artifact_utils._download_artifact_from_uri",
          return_value=0,
      ) as download_uri_mock:
          # Verify that we don't attempt to call download_uri when passing a local file to a
          # parameter of type "path"
          with TempDir() as tmp:
              dst_dir = tmp.path()
              local_path = os.path.join(TEST_PROJECT_DIR, "MLproject")
              params, _ = entry_point.compute_parameters(
                  user_parameters={"path": local_path},
                  storage_dir=dst_dir,
              )
              assert params["path"] == os.path.abspath(local_path)
              assert download_uri_mock.call_count == 0
  
              params, _ = entry_point.compute_parameters(
                  user_parameters={
                      "path": path_to_local_file_uri(local_path)
                  },
                  storage_dir=dst_dir,
              )
              assert params["path"] == os.path.abspath(local_path)
              assert download_uri_mock.call_count == 0
  
          # Verify that we raise an exception when passing a non-existent local file to a
          # parameter of type "path"
          with TempDir() as tmp:
              dst_dir = tmp.path()
              with pytest.raises(
                  ExecutionException, match="no such file or directory"
              ):
                  entry_point.compute_parameters(
                      user_parameters={
                          "path": os.path.join(
                              dst_dir, "some/nonexistent/file"
                          )
                      },
                      storage_dir=dst_dir,
                  )
          # Verify that we do call `download_uri` when passing a URI to a parameter of type "path"
          for i, prefix in enumerate(["dbfs:/", "s3://", "gs://"]):
              with TempDir() as tmp:
                  dst_dir = tmp.path()
                  file_to_download = "images.tgz"
                  download_path = f"{dst_dir}/{file_to_download}"
                  download_uri_mock.return_value = download_path
                  params, _ = entry_point.compute_parameters(
                      user_parameters={
                          "path": os.path.join(prefix, file_to_download)
                      },
                      storage_dir=dst_dir,
                  )
                  assert params["path"] == download_path
                  assert download_uri_mock.call_count == i + 1
  
file_path: mlflow/tests/projects/test_entry_point.py
imports: import os
  from shlex import quote
  from unittest import mock
  import pytest
  from mlflow.exceptions import ExecutionException
  from mlflow.projects._project_spec import EntryPoint
  from mlflow.utils.file_utils import TempDir, path_to_local_file_uri
  from tests.projects.utils import TEST_PROJECT_DIR, load_project
label_desc: Use image node_id 3 for calling a global function with example usage: test_path_parameter() without return types