code: def test_get_model_dependencies_read_conda_file(
      ml_model_file_content, tmp_path
  ):
      MLmodel_file = tmp_path / "MLmodel"
      MLmodel_file.write_text(ml_model_file_content)
      conda_yml_file = tmp_path / "conda.yaml"
      conda_yml_file_content = f"""
  channels:
  - conda-forge
  dependencies:
  - python={PYTHON_VERSION}
  - pip=22.0.3
  - scikit-learn=0.22.0
  - tensorflow=2.0.0
  - pip:
    - mlflow
    - cloudpickle==2.0.0
    - scikit-learn==1.0.1
  name: mlflow-env
  """
  
      conda_yml_file.write_text(conda_yml_file_content)
  
      model_path = str(tmp_path)
  
      # Test getting conda environment
      assert (
          Path(
              get_model_dependencies(model_path, format="conda")
          ).read_text()
          == conda_yml_file_content
      )
  
      # Test getting pip requirement file failed and fallback to extract pip section from conda.yaml
      with mock.patch("mlflow.pyfunc._logger.warning") as mock_warning:
          pip_file_path = get_model_dependencies(
              model_path, format="pip"
          )
          assert (
              Path(pip_file_path).read_text().strip()
              == "mlflow\ncloudpickle==2.0.0\nscikit-learn==1.0.1"
          )
          mock_warning.assert_called_once_with(
              "The following conda dependencies have been excluded from the environment file: "
              f"python={PYTHON_VERSION}, pip=22.0.3, scikit-learn=0.22.0, tensorflow=2.0.0."
          )
  
      conda_yml_file.write_text(
          f"""
  channels:
  - conda-forge
  dependencies:
  - python={PYTHON_VERSION}
  - pip=22.0.3
  - scikit-learn=0.22.0
  - tensorflow=2.0.0
  """
      )
  
      with pytest.raises(
          MlflowException,
          match="No pip section found in conda.yaml file",
      ):
          get_model_dependencies(model_path, format="pip")
  
file_path: mlflow/tests/pyfunc/test_dependencies_functions.py
imports: from pathlib import Path
  from unittest import mock
  import cloudpickle
  import pytest
  import sklearn
  from sklearn.linear_model import LinearRegression
  import mlflow.utils.requirements_utils
  from mlflow.exceptions import MlflowException
  from mlflow.pyfunc import _warn_dependency_requirement_mismatches, get_model_dependencies
  from mlflow.utils import PYTHON_VERSION
  from tests.helper_functions import AnyStringWith
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_model_dependencies_read_conda_file(ml_model_file_content, tmp_path) without return types