cx-han-cx commented on code in PR #58477:
URL: https://github.com/apache/airflow/pull/58477#discussion_r2540851021


##########
providers/amazon/tests/unit/amazon/aws/executors/aws_lambda/docker/test_app.py:
##########
@@ -0,0 +1,463 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import json
+import os
+import subprocess
+from unittest.mock import MagicMock, patch
+
+import pytest
+
+from airflow.providers.amazon.aws.executors.aws_lambda.docker.app import (
+    COMMAND_KEY,
+    EXECUTOR_CONFIG_KEY,
+    RETURN_CODE_KEY,
+    TASK_KEY_KEY,
+    fetch_dags_from_s3,
+    get_queue_url,
+    get_sqs_client,
+    lambda_handler,
+    run_and_report,
+)
+
+
+class TestApp:
+    """Test cases for the AWS Lambda Docker app."""
+
+    @pytest.fixture(autouse=True)
+    def setup_environment(self):
+        """Setup test environment for each test."""
+        # Set required environment variables
+        os.environ["AIRFLOW__AWS_LAMBDA_EXECUTOR__QUEUE_URL"] = (
+            "https://sqs.us-east-1.amazonaws.com/123456789012/test-queue";
+        )
+        yield
+        # Clean up
+        if "AIRFLOW__AWS_LAMBDA_EXECUTOR__QUEUE_URL" in os.environ:
+            del os.environ["AIRFLOW__AWS_LAMBDA_EXECUTOR__QUEUE_URL"]
+        # Clean up DAGS_FOLDER if it was set
+        if "AIRFLOW__CORE__DAGS_FOLDER" in os.environ:
+            del os.environ["AIRFLOW__CORE__DAGS_FOLDER"]
+

Review Comment:
   Using patch.dict would be cleaner and more robust. 
   I will modify the code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to