From 21f4e9a6072885fa9acaa35a9bfabacb3edc995f Mon Sep 17 00:00:00 2001 From: Hai Nguyen Date: Sun, 17 Mar 2024 16:47:18 +0700 Subject: [PATCH] Move cloned entries declaration out of raise assertion scope Signed-off-by: Hai Nguyen --- .../operators/test_custom_object_launcher.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/providers/cncf/kubernetes/operators/test_custom_object_launcher.py b/tests/providers/cncf/kubernetes/operators/test_custom_object_launcher.py index 06eb802481a9d4..d33fdd6048f43a 100644 --- a/tests/providers/cncf/kubernetes/operators/test_custom_object_launcher.py +++ b/tests/providers/cncf/kubernetes/operators/test_custom_object_launcher.py @@ -77,28 +77,29 @@ def test_spark_job_spec_dynamicAllocation_enabled_with_invalid_config(self): "executor": {}, } } + + cloned_entries = entries.copy() + cloned_entries["spec"]["dynamicAllocation"]["initialExecutors"] = None with pytest.raises( AirflowException, match="Make sure initial/min/max value for dynamic allocation is passed", ): - cloned_entries = entries.copy() - cloned_entries["spec"]["dynamicAllocation"]["initialExecutors"] = None SparkJobSpec(**cloned_entries) + cloned_entries = entries.copy() + cloned_entries["spec"]["dynamicAllocation"]["minExecutors"] = None with pytest.raises( AirflowException, match="Make sure initial/min/max value for dynamic allocation is passed", ): - cloned_entries = entries.copy() - cloned_entries["spec"]["dynamicAllocation"]["minExecutors"] = None SparkJobSpec(**cloned_entries) + cloned_entries = entries.copy() + cloned_entries["spec"]["dynamicAllocation"]["maxExecutors"] = None with pytest.raises( AirflowException, match="Make sure initial/min/max value for dynamic allocation is passed", ): - cloned_entries = entries.copy() - cloned_entries["spec"]["dynamicAllocation"]["maxExecutors"] = None SparkJobSpec(**cloned_entries)