kosteev commented on a change in pull request #22311:
URL: https://github.com/apache/airflow/pull/22311#discussion_r831016711



##########
File path: tests/system/conftest.py
##########
@@ -0,0 +1,61 @@
+# 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.
+
+import os
+import re
+from itertools import chain
+from pathlib import Path
+
+import pytest
+
+OLD_EXECUTOR = os.environ.get("AIRFLOW__CORE__EXECUTOR", default=None)
+REQUIRED_ENV_VARS = ("SYSTEM_TESTS_ENV_ID",)
+
+
+def pytest_configure(config):
+    os.environ["AIRFLOW__CORE__EXECUTOR"] = "DebugExecutor"
+
+
+def pytest_unconfigure(config):
+    if OLD_EXECUTOR is not None:
+        os.environ["AIRFLOW__CORE__EXECUTOR"] = OLD_EXECUTOR

Review comment:
       My concern was about the case when "AIRFLOW__CORE__EXECUTOR" environment 
variable is not set before (and it means prev_executor will be None), and then 
"AIRFLOW__CORE__EXECUTOR" will not be unset because of this condition "if 
prev_executor is not None:".
   I do not know the details of execution, maybe this will not happen or not an 
issue, but technically speaking looks wrong and asks for question. WDYT?
   
   I was thinking about this or something similar.
   <pre>
   with mock.patch.dict("os.environ", AIRFLOW__CORE__EXECUTOR="DebugExecutor"):
       yield
   </pre>




-- 
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