code: def test_process_conda_env(tmp_path):
      def make_conda_env(pip_deps):
          return {
              "name": "mlflow-env",
              "channels": ["conda-forge"],
              "dependencies": [
                  "python=3.8.15",
                  "pip",
                  {"pip": pip_deps},
              ],
          }
  
      expected_mlflow_ver = _mlflow_major_version_string()
  
      conda_env, reqs, cons = _process_conda_env(make_conda_env(["a"]))
      assert _get_pip_deps(conda_env) == [expected_mlflow_ver, "a"]
      assert reqs == [expected_mlflow_ver, "a"]
      assert cons == []
  
      conda_env_file = tmp_path.joinpath("conda_env.yaml")
      conda_env_file.write_text(yaml.dump(make_conda_env(["a"])))
      conda_env, reqs, cons = _process_conda_env(str(conda_env_file))
      assert _get_pip_deps(conda_env) == [expected_mlflow_ver, "a"]
      assert reqs == [expected_mlflow_ver, "a"]
      assert cons == []
  
      # Ensure a requirement for mlflow is preserved
      conda_env, reqs, cons = _process_conda_env(
          make_conda_env(["mlflow==1.2.3"])
      )
      assert _get_pip_deps(conda_env) == ["mlflow==1.2.3"]
      assert reqs == ["mlflow==1.2.3"]
      assert cons == []
  
      con_file = tmp_path.joinpath("constraints.txt")
      con_file.write_text("c")
      conda_env, reqs, cons = _process_conda_env(
          make_conda_env(["a", f"-c {con_file}"])
      )
      assert _get_pip_deps(conda_env) == [
          expected_mlflow_ver,
          "a",
          "-c constraints.txt",
      ]
      assert reqs == [expected_mlflow_ver, "a", "-c constraints.txt"]
      assert cons == ["c"]
  
      # NB: mlflow-skinny is not automatically attached to any model. If specified, it is
      # up to the user to pin a version.
      conda_env, reqs, cons = _process_conda_env(
          make_conda_env(["mlflow-skinny", "a", "b"])
      )
      assert _get_pip_deps(conda_env) == ["mlflow-skinny", "a", "b"]
      assert reqs == ["mlflow-skinny", "a", "b"]
      assert cons == []
  
      with pytest.raises(
          TypeError, match=r"Expected .+, but got `int`"
      ):
          _process_conda_env(0)
  
imports: import os
  import pytest
  import yaml
  from mlflow.exceptions import MlflowException
  from mlflow.utils.environment import _contains_mlflow_requirement, _deduplicate_requirements, _get_pip_deps, _get_pip_requirement_specifier, _is_mlflow_requirement, _is_pip_deps, _mlflow_conda_env, _overwrite_pip_deps, _parse_pip_requirements, _process_conda_env, _process_pip_requirements, _validate_env_arguments
  from tests.helper_functions import _mlflow_major_version_string
label_desc: Use image node_id 20 for calling a global function with example usage: test_process_conda_env(tmp_path) and returns: dict