code: def test_register_step_run(
      tmp_recipe_root_path: Path,
      tmp_recipe_exec_path: Path,
      mae_threshold: int,
      register_flag: str,
  ):
      (
          evaluate_step_output_dir,
          register_step_output_dir,
      ) = setup_model_and_evaluate(tmp_recipe_exec_path)
      recipe_yaml = tmp_recipe_root_path.joinpath(
          _RECIPE_CONFIG_FILE_NAME
      )
      recipe_yaml.write_text(
          f"""
  recipe: "regression/v1"
  target_col: "y"
  experiment:
    tracking_uri: {mlflow.get_tracking_uri()}
  model_registry:
    model_name: "demo_model"
  steps:
    evaluate:
      validation_criteria:
        - metric: root_mean_squared_error
          threshold: 1_000_000
        - metric: mean_absolute_error
          threshold: {mae_threshold}
        - metric: weighted_mean_squared_error
          threshold: 1_000_000
    register:
      {register_flag}
  custom_metrics:
    - name: weighted_mean_squared_error
      function: weighted_mean_squared_error
      greater_is_better: False
  """
      )
      recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
      recipe_steps_dir.mkdir(parents=True)
      recipe_steps_dir.joinpath("custom_metrics.py").write_text(
          """
  def weighted_mean_squared_error(eval_df, builtin_metrics):
      from sklearn.metrics import mean_squared_error
  
      return mean_squared_error(
          eval_df["prediction"],
          eval_df["target"],
          sample_weight=1 / eval_df["prediction"].values,
      )
  """
      )
      recipe_config = read_yaml(
          tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME
      )
      evaluate_step = EvaluateStep.from_recipe_config(
          recipe_config, str(tmp_recipe_root_path)
      )
      evaluate_step.run(str(evaluate_step_output_dir))
      assert (
          len(mlflow.tracking.MlflowClient().search_registered_models())
          == 0
      )
      register_step = RegisterStep.from_recipe_config(
          recipe_config, str(tmp_recipe_root_path)
      )
      if mae_threshold < 0:
          with pytest.raises(
              MlflowException, match=r"Model registration on .* failed"
          ):
              register_step.run(str(register_step_output_dir))
      else:
          register_step.run(str(register_step_output_dir))
          model_validation_status_path = (
              evaluate_step_output_dir.joinpath(
                  "model_validation_status"
              )
          )
          assert model_validation_status_path.exists()
          assert model_validation_status_path.read_text() == "VALIDATED"
          mv_info_file_path = register_step_output_dir.joinpath(
              _REGISTERED_MV_INFO_FILE
          )
          assert mv_info_file_path.exists()
          assert (
              len(
                  mlflow.tracking.MlflowClient().search_registered_models()
              )
              == 1
          )
  
file_path: mlflow/tests/recipes/test_register_step.py
imports: from pathlib import Path
  import pytest
  import mlflow
  from mlflow.exceptions import MlflowException
  from mlflow.recipes.steps.evaluate import EvaluateStep
  from mlflow.recipes.steps.register import _REGISTERED_MV_INFO_FILE, RegisterStep
  from mlflow.recipes.utils import _RECIPE_CONFIG_FILE_NAME
  from mlflow.utils.file_utils import read_yaml
  from mlflow.utils.mlflow_tags import MLFLOW_RECIPE_TEMPLATE_NAME, MLFLOW_SOURCE_TYPE
  from tests.recipes.helper_functions import setup_model_and_evaluate
label_desc: Use image node_id 1 for calling a global function with example usage: test_register_step_run(tmp_recipe_root_path, tmp_recipe_exec_path, mae_threshold, register_flag) without return types