mik-laj commented on a change in pull request #11693: URL: https://github.com/apache/airflow/pull/11693#discussion_r511642713
########## File path: chart/tests/conftest.py ########## @@ -0,0 +1,33 @@ +# 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 subprocess +import sys + +# We should set these before loading _any_ of the rest of airflow so that the +# unit test mode config is set as early as possible. +tests_directory = os.path.dirname(os.path.realpath(__file__)) + +os.environ["AIRFLOW__CORE__DAGS_FOLDER"] = os.path.join(tests_directory, "dags") +os.environ["AIRFLOW__CORE__UNIT_TEST_MODE"] = "True" +os.environ["AWS_DEFAULT_REGION"] = (os.environ.get("AWS_DEFAULT_REGION") or "us-east-1") +os.environ["CREDENTIALS_DIR"] = (os.environ.get('CREDENTIALS_DIR') or "/files/airflow-breeze-config/keys") + +subprocess.check_output(["helm", "repo", "add", "stable", + "https://kubernetes-charts.storage.googleapis.com/"]) +subprocess.check_output(["helm", "dep", "update", sys.path[0]]) Review comment: ```suggestion import subprocess import sys import pytest @pytest.fixture(autouse=True, scope="session") def upgrade_helm(): """ Upgrade Helm repo """ subprocess.check_output([ "helm", "repo", "add", "stable", "https://kubernetes-charts.storage.googleapis.com/" ]) subprocess.check_output(["helm", "dep", "update", sys.path[0]]) ``` It is better to avoid executing code at the module level as this results in an bad end user experience. When you run the Pytest command, you have black screen for a long time with no message. After the change is made, the tests are run and fixutres are executed as part of the tests. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
