code: def test_get_model_dependencies_read_req_file(tmp_path):
      req_file = tmp_path / "requirements.txt"
      req_file_content = """
  mlflow
  cloudpickle==2.0.0
  scikit-learn==1.0.2"""
      req_file.write_text(req_file_content)
  
      model_path = str(tmp_path)
  
      # Test getting pip dependencies
      assert (
          Path(
              get_model_dependencies(model_path, format="pip")
          ).read_text()
          == req_file_content
      )
  
      # Test getting pip dependencies will print instructions
      with mock.patch("mlflow.pyfunc._logger.info") as mock_log_info:
          get_model_dependencies(model_path, format="pip")
          mock_log_info.assert_called_once_with(
              "To install the dependencies that were used to train the model, run the "
              f"following command: 'pip install -r {req_file}'."
          )
  
          mock_log_info.reset_mock()
          with mock.patch(
              "mlflow.pyfunc._is_in_ipython_notebook", return_value=True
          ):
              get_model_dependencies(model_path, format="pip")
              mock_log_info.assert_called_once_with(
                  "To install the dependencies that were used to train the model, run the "
                  f"following command: '%pip install -r {req_file}'."
              )
  
      with pytest.raises(
          MlflowException, match="Illegal format argument 'abc'"
      ):
          get_model_dependencies(model_path, format="abc")
  
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 2 for calling a global function with example usage: test_get_model_dependencies_read_req_file(tmp_path) without return types