code: def test_run_recipe_step_sets_environment_as_expected(tmp_path):
      class TestStep1(BaseStepImplemented):
          def __init__(self):  # pylint: disable=super-init-not-called
              self.step_config = {}
  
          @property
          def name(self):
              return "test_step_1"
  
          @property
          def environment(self):
              return {"A": "B"}
  
      class TestStep2(BaseStepImplemented):
          def __init__(self):  # pylint: disable=super-init-not-called
              self.step_config = {}
  
          @property
          def name(self):
              return "test_step_2"
  
          @property
          def environment(self):
              return {"C": "D"}
  
      with mock.patch(
          "mlflow.recipes.utils.execution._exec_cmd"
      ) as mock_run_in_subprocess, mock.patch(
          "mlflow.recipes.utils.execution._ExecutionPlan"
      ):
          process = mock.Mock()
          process.stdout.readline = mock.Mock(side_effect="")
          mock_run_in_subprocess.return_value = process
  
          recipe_steps = [TestStep1(), TestStep2()]
          run_recipe_step(
              recipe_root_path=tmp_path,
              recipe_steps=recipe_steps,
              target_step=recipe_steps[0],
              template="regression/v1",
          )
  
      _, subprocess_call_kwargs = mock_run_in_subprocess.call_args
      assert subprocess_call_kwargs.get("extra_env") == {
          "A": "B",
          "C": "D",
          MLFLOW_RECIPES_EXECUTION_TARGET_STEP_NAME.name: "test_step_1",
      }
      assert mock_run_in_subprocess.call_count == 2
  
imports: import os
  import pathlib
  import shutil
  import time
  from unittest import mock
  import pandas
  import pytest
  from mlflow.environment_variables import MLFLOW_RECIPES_EXECUTION_TARGET_STEP_NAME
  from mlflow.recipes import Recipe
  from mlflow.recipes.step import StepStatus
  from mlflow.recipes.steps.ingest import IngestStep
  from mlflow.recipes.steps.split import SplitStep
  from mlflow.recipes.steps.transform import TransformStep
  from mlflow.recipes.utils.execution import _ExecutionPlan, _get_or_create_execution_directory, get_step_output_path, run_recipe_step
  from tests.recipes.helper_functions import BaseStepImplemented
label_desc: Use image node_id 6 for calling a global function with example usage: test_run_recipe_step_sets_environment_as_expected(tmp_path) and returns: str, dict, str, dict