Repository: mlflow/mlflow

Issue:
Upgrade ruff to 0.0.279
Ruff 0.0.279 should be released soon. Once it's released we can update this line to install it:

https://github.com/mlflow/mlflow/blob/dc5885a80c06981379d9b5379506c4fc746b5412/requirements/lint-requirements.txt#L2




Discussion:

Resolving patch:
diff --git a/mlflow/pyfunc/backend.py b/mlflow/pyfunc/backend.py
--- a/mlflow/pyfunc/backend.py
+++ b/mlflow/pyfunc/backend.py
@@ -380,14 +380,10 @@ def copy_model_into_container(dockerfile_context_dir):
                     env_manager=self._env_manager,
                 )
             else:
-                return """
-                    ENV {disable_env}="true"
-                    ENV {ENABLE_MLSERVER}={enable_mlserver}
-                    """.format(
-                    disable_env=DISABLE_ENV_CREATION,
-                    ENABLE_MLSERVER=ENABLE_MLSERVER,
-                    enable_mlserver=repr(enable_mlserver),
-                )
+                return f"""
+                    ENV {DISABLE_ENV_CREATION}="true"
+                    ENV {ENABLE_MLSERVER}={repr(enable_mlserver)}
+                    """
 
         return copy_model_into_container
 


Test patch:
diff --git a/tests/projects/test_projects.py b/tests/projects/test_projects.py
--- a/tests/projects/test_projects.py
+++ b/tests/projects/test_projects.py
@@ -360,20 +360,16 @@ def exec_cmd_mock_raise(cmd, *args, **kwargs):  # pylint: disable=unused-argumen
 
 def test_conda_environment_cleaned_up_when_pip_fails(tmp_path):
     conda_yaml = tmp_path / "conda.yaml"
-    content = """
-name: {name}
+    content = f"""
+name: {uuid.uuid4().hex}
 channels:
   - conda-forge
 dependencies:
-  - python={python_version}
+  - python={PYTHON_VERSION}
   - pip
   - pip:
       - mlflow==999.999.999
-""".format(
-        # Enforce creating a new environment
-        name=uuid.uuid4().hex,
-        python_version=PYTHON_VERSION,
-    )
+"""
     conda_yaml.write_text(content)
     envs_before = mlflow.utils.conda._list_conda_environments()
 
diff --git a/tests/recipes/test_evaluate_step.py b/tests/recipes/test_evaluate_step.py
--- a/tests/recipes/test_evaluate_step.py
+++ b/tests/recipes/test_evaluate_step.py
@@ -55,11 +55,11 @@ def test_evaluate_step_run(
 
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -73,10 +73,7 @@ def test_evaluate_step_run(
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error_func
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-            mae_threshold=mae_threshold,
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -116,21 +113,19 @@ def test_evaluate_produces_expected_step_card(
 
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
 recipe: "classification/v1"
 positive_class: "Iris-setosa"
 target_col: "y"
 primary_metric: "f1_score"
 experiment:
-  tracking_uri: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
       - metric: f1_score
         threshold: 10
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -154,16 +149,14 @@ def test_no_validation_criteria(tmp_recipe_root_path: Path, 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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -185,11 +178,11 @@ def test_no_validation_criteria(tmp_recipe_root_path: Path, tmp_recipe_exec_path
 def test_validation_criteria_contain_undefined_metrics(tmp_recipe_root_path: 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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -197,9 +190,7 @@ def test_validation_criteria_contain_undefined_metrics(tmp_recipe_root_path: Pat
         threshold: 100
       - metric: undefined_metric
         threshold: 100
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -220,11 +211,11 @@ def test_custom_metric_function_does_not_exist(
 ):
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -234,9 +225,7 @@ def test_custom_metric_function_does_not_exist(
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -262,11 +251,11 @@ def test_custom_metrics_module_does_not_exist(
 ):
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -276,9 +265,7 @@ def test_custom_metrics_module_does_not_exist(
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -302,11 +289,11 @@ def test_custom_metrics_override_builtin_metrics(
 
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -321,9 +308,7 @@ def test_custom_metrics_override_builtin_metrics(
   - name: root_mean_squared_error
     function: root_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -369,19 +354,17 @@ def test_evaluate_step_writes_card_with_model_and_run_links_on_databricks(
 
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
       - metric: root_mean_squared_error
         threshold: 1_000_000
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
 
     evaluate_step_output_dir = tmp_recipe_exec_path.joinpath("steps", "evaluate", "outputs")
diff --git a/tests/recipes/test_predict_step.py b/tests/recipes/test_predict_step.py
--- a/tests/recipes/test_predict_step.py
+++ b/tests/recipes/test_predict_step.py
@@ -69,14 +69,12 @@ def predict_step_output_dir(tmp_recipe_root_path: Path, tmp_recipe_exec_path: Pa
     predict_step_output_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
 recipe: "regression/v1"
 experiment:
   name: "test"
-  tracking_uri: {tracking_uri}
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-        )
+  tracking_uri: {mlflow.get_tracking_uri()}
+"""
     )
     return predict_step_output_dir
 
diff --git a/tests/recipes/test_register_step.py b/tests/recipes/test_register_step.py
--- a/tests/recipes/test_register_step.py
+++ b/tests/recipes/test_register_step.py
@@ -36,11 +36,11 @@ def test_register_step_run(
     )
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 model_registry:
   model_name: "demo_model"
 steps:
@@ -53,16 +53,12 @@ def test_register_step_run(
       - metric: weighted_mean_squared_error
         threshold: 1_000_000
   register:
-    {allow_non_validated_model}
+    {register_flag}
 custom_metrics:
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-            mae_threshold=mae_threshold,
-            allow_non_validated_model=register_flag,
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -106,21 +102,18 @@ def test_register_with_no_validation_criteria(
     )
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 model_registry:
   model_name: "demo_model"
 steps:
   evaluate:
   register:
-    {allow_non_validated_model}
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-            allow_non_validated_model=register_flag,
-        )
+    {register_flag}
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -151,13 +144,13 @@ def test_usage_tracking_correctly_added(
     )
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
 recipe: "regression/v1"
 target_col: "y"
 model_registry:
   model_name: "demo_model"
 experiment:
-  tracking_uri: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 steps:
   evaluate:
     validation_criteria:
@@ -171,9 +164,7 @@ def test_usage_tracking_correctly_added(
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -211,11 +202,11 @@ def test_register_uri(
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     registry_uri = registry_uri_path
     recipe_yaml.write_text(
-        """
+        f"""
 recipe: "regression/v1"
 target_col: "y"
 experiment:
-  tracking_uri: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 model_registry:
   registry_uri: {registry_uri}
   model_name: "demo_model"
@@ -232,10 +223,7 @@ def test_register_uri(
   - name: weighted_mean_squared_error
     function: weighted_mean_squared_error
     greater_is_better: False
-""".format(
-            tracking_uri=mlflow.get_tracking_uri(),
-            registry_uri=registry_uri,
-        )
+"""
     )
     recipe_steps_dir = tmp_recipe_root_path.joinpath("steps")
     recipe_steps_dir.mkdir(parents=True)
@@ -271,11 +259,11 @@ def test_register_step_writes_card_with_model_link_and_version_link_on_databrick
 
     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: {tracking_uri}
+  tracking_uri: {mlflow.get_tracking_uri()}
 model_registry:
   model_name: "demo_model"
 steps:
@@ -283,9 +271,7 @@ def test_register_step_writes_card_with_model_link_and_version_link_on_databrick
     validation_criteria:
       - metric: root_mean_squared_error
         threshold: 1_000_000
-""".format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+"""
     )
 
     evaluate_step_output_dir, register_step_output_dir = setup_model_and_evaluate(
diff --git a/tests/recipes/test_split_step.py b/tests/recipes/test_split_step.py
--- a/tests/recipes/test_split_step.py
+++ b/tests/recipes/test_split_step.py
@@ -270,7 +270,7 @@ def test_custom_split_method(tmp_recipe_root_path: Path, tmp_recipe_exec_path: P
 
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "regression/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -279,14 +279,12 @@ def test_custom_split_method(tmp_recipe_root_path: Path, tmp_recipe_exec_path: P
             step: "split"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             split:
                 using: custom
                 split_method: split_method
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
 
     m_split = Mock()
@@ -334,7 +332,7 @@ def test_custom_error_split_method(tmp_recipe_root_path: Path, tmp_recipe_exec_p
 
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "regression/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -343,14 +341,12 @@ def test_custom_error_split_method(tmp_recipe_root_path: Path, tmp_recipe_exec_p
             step: "split"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             split:
                 using: custom
                 split_method: split_method
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
 
     m_split = Mock()
diff --git a/tests/recipes/test_train_step.py b/tests/recipes/test_train_step.py
--- a/tests/recipes/test_train_step.py
+++ b/tests/recipes/test_train_step.py
@@ -116,7 +116,7 @@ def setup_train_step_with_tuning(
     estimator_fn = "estimator_fn" if recipe == "regression" else "classifier_estimator_fn"
     if use_tuning:
         recipe_yaml.write_text(
-            """
+            f"""
             recipe: "{recipe}/v1"
             target_col: "y"
             profile: "test_profile"
@@ -124,11 +124,11 @@ def setup_train_step_with_tuning(
                 step: "train"
             experiment:
                 name: "demo"
-                tracking_uri: {tracking_uri}
+                tracking_uri: {mlflow.get_tracking_uri()}
             steps:
                 train:
                     using: custom
-                    estimator_method: {fn}
+                    estimator_method: {estimator_fn}
                     {estimator_params}
                     tuning:
                         enabled: true
@@ -146,16 +146,11 @@ def setup_train_step_with_tuning(
                                 distribution: "normal"
                                 mu: 0.01
                                 sigma: 0.0001
-            """.format(
-                tracking_uri=mlflow.get_tracking_uri(),
-                estimator_params=estimator_params,
-                recipe=recipe,
-                fn=estimator_fn,
-            )
+            """
         )
     else:
         recipe_yaml.write_text(
-            """
+            f"""
             recipe: "{recipe}/v1"
             target_col: "y"
             profile: "test_profile"
@@ -163,16 +158,14 @@ def setup_train_step_with_tuning(
                 step: "train"
             experiment:
                 name: "demo"
-                tracking_uri: {tracking_uri}
+                tracking_uri: {mlflow.get_tracking_uri()}
             steps:
                 train:
                     using: custom
-                    estimator_method: {fn}
+                    estimator_method: {estimator_fn}
                     tuning:
                         enabled: false
-            """.format(
-                tracking_uri=mlflow.get_tracking_uri(), recipe=recipe, fn=estimator_fn
-            )
+            """
         )
     recipe_config = read_yaml(recipe_root, _RECIPE_CONFIG_FILE_NAME)
     train_step = TrainStep.from_recipe_config(recipe_config, str(recipe_root))
@@ -185,7 +178,7 @@ def test_train_step(tmp_recipe_root_path: Path, tmp_recipe_exec_path: Path):
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "regression/v1"
         target_col: "y"
         profile: "test_profile"
@@ -193,16 +186,14 @@ def test_train_step(tmp_recipe_root_path: Path, tmp_recipe_exec_path: Path):
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
                 estimator_method: estimator_fn
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     m_train = Mock()
     m_train.estimator_fn = estimator_fn
@@ -227,7 +218,7 @@ def test_train_step_imbalanced_data(tmp_recipe_root_path: Path, tmp_recipe_exec_
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "classification/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -237,16 +228,14 @@ def test_train_step_imbalanced_data(tmp_recipe_root_path: Path, tmp_recipe_exec_
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
                 estimator_method: estimator_fn
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     m_train = Mock()
     m_train.estimator_fn = classifier_estimator_fn
@@ -693,7 +682,7 @@ def test_train_step_with_predict_probability(
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "classification/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -703,16 +692,14 @@ def test_train_step_with_predict_probability(
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
                 estimator_method: estimator_fn
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     with mock.patch("steps.train.estimator_fn", return_value=sklearn_logistic_regression()):
         recipe_config = read_yaml(tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME)
@@ -764,7 +751,7 @@ def test_train_step_with_predict_probability_with_custom_prefix(
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "classification/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -774,7 +761,7 @@ def test_train_step_with_predict_probability_with_custom_prefix(
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
@@ -782,9 +769,7 @@ def test_train_step_with_predict_probability_with_custom_prefix(
                 predict_prefix: "custom_prefix_"
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     with mock.patch("steps.train.estimator_fn", return_value=sklearn_logistic_regression()):
         recipe_config = read_yaml(tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME)
@@ -821,7 +806,7 @@ def test_train_step_with_label_encoding(tmp_recipe_root_path: Path, tmp_recipe_e
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "classification/v1"
         target_col: "y"
         profile: "test_profile"
@@ -829,16 +814,14 @@ def test_train_step_with_label_encoding(tmp_recipe_root_path: Path, tmp_recipe_e
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
                 estimator_method: estimator_fn
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     with mock.patch("steps.train.estimator_fn", return_value=xgb_classifier()):
         recipe_config = read_yaml(tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME)
@@ -875,7 +858,7 @@ def test_train_step_with_probability_calibration(
     recipe_steps_dir.mkdir(parents=True)
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "classification/v1"
         target_col: "y"
         primary_metric: "f1_score"
@@ -885,7 +868,7 @@ def test_train_step_with_probability_calibration(
             step: "train"
         experiment:
             name: "demo"
-            tracking_uri: {tracking_uri}
+            tracking_uri: {mlflow.get_tracking_uri()}
         steps:
             train:
                 using: custom
@@ -893,9 +876,7 @@ def test_train_step_with_probability_calibration(
                 calibrate_proba: isotonic
                 tuning:
                     enabled: false
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri()
-        )
+        """
     )
     with mock.patch("steps.train.estimator_fn", return_value=sklearn_logistic_regression()):
         recipe_config = read_yaml(tmp_recipe_root_path, _RECIPE_CONFIG_FILE_NAME)
diff --git a/tests/recipes/test_transform_step.py b/tests/recipes/test_transform_step.py
--- a/tests/recipes/test_transform_step.py
+++ b/tests/recipes/test_transform_step.py
@@ -40,21 +40,17 @@ def set_up_transform_step(recipe_root: Path, transform_user_module):
     MlflowClient().create_experiment(experiment_name)
 
     recipe_yaml.write_text(
-        """
+        f"""
         recipe: "regression/v1"
         target_col: "y"
         experiment:
           name: {experiment_name}
-          tracking_uri: {tracking_uri}
+          tracking_uri: {mlflow.get_tracking_uri()}
         steps:
           transform:
             using: custom
             transformer_method: {transform_user_module}
-        """.format(
-            tracking_uri=mlflow.get_tracking_uri(),
-            experiment_name=experiment_name,
-            transform_user_module=transform_user_module,
-        )
+        """
     )
     recipe_config = read_yaml(recipe_root, _RECIPE_CONFIG_FILE_NAME)
     transform_step = TransformStep.from_recipe_config(recipe_config, str(recipe_root))