This is an automated email from the ASF dual-hosted git repository.

pankajkoti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9a50475121 Fix side effects in AWS Batch Executor test (#39474)
9a50475121 is described below

commit 9a50475121a1ff5b82bd93c39c3ed1c845bd95ac
Author: Kaxil Naik <[email protected]>
AuthorDate: Wed May 8 07:53:26 2024 +0100

    Fix side effects in AWS Batch Executor test (#39474)
    
    This wasted a lot of my hours in debugging failures for 
https://github.com/apache/airflow/pull/39450
    
    This was modifying a global env vars and causing side effects in other tests
---
 tests/providers/amazon/aws/executors/batch/test_batch_executor.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/providers/amazon/aws/executors/batch/test_batch_executor.py 
b/tests/providers/amazon/aws/executors/batch/test_batch_executor.py
index 8a5773bdca..5650f04b60 100644
--- a/tests/providers/amazon/aws/executors/batch/test_batch_executor.py
+++ b/tests/providers/amazon/aws/executors/batch/test_batch_executor.py
@@ -537,11 +537,9 @@ class TestAwsBatchExecutor:
         batch_mock.describe_jobs.side_effect = {}
         executor.batch = batch_mock
 
-        
os.environ[f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllBatchConfigKeys.CHECK_HEALTH_ON_STARTUP}".upper()]
 = (
-            "False"
-        )
-
-        executor.start()
+        env_var_key = 
f"AIRFLOW__{CONFIG_GROUP_NAME}__{AllBatchConfigKeys.CHECK_HEALTH_ON_STARTUP}".upper()
+        with mock.patch.dict(os.environ, {env_var_key: "False"}):
+            executor.start()
 
         batch_mock.describe_jobs.assert_not_called()
 

Reply via email to