From 6964eac1f7f4e1b0a472ae6381c90253e219fa5b Mon Sep 17 00:00:00 2001 From: srlee056 Date: Tue, 5 Mar 2024 02:10:03 +0900 Subject: [PATCH] [feat]: modify test for not checking Variable --- tests/dags/test_dag_integrity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/dags/test_dag_integrity.py b/tests/dags/test_dag_integrity.py index 70e9163..b4b9b61 100644 --- a/tests/dags/test_dag_integrity.py +++ b/tests/dags/test_dag_integrity.py @@ -3,6 +3,7 @@ import glob import os import pytest +from unittest.mock import patch # from airflow.models import DAG from airflow.models.dagbag import DagBag @@ -21,11 +22,10 @@ def test_dag_integrity(dag_file): Args: dag_file (str): The path to a DAG file to be tested. """ - dag_bag = DagBag(dag_folder=os.path.dirname(dag_file), include_examples=False) + with patch("airflow.models.Variable.get", return_value="dummy_value"): + dag_bag = DagBag(dag_folder=os.path.dirname(dag_file), include_examples=False) + dag_bag.process_file(dag_file, only_if_updated=True) - dag_bag.process_file(dag_file, only_if_updated=True) - - # dag_id, dag in dag_bag.dags.items() - for dag_id, _ in dag_bag.dags.items(): - assert dag_id in dag_bag.dags, "DAG ID not found in dag_bag.dags" - assert not dag_bag.import_errors, "Import errors found in DagBag" + for dag_id, _ in dag_bag.dags.items(): + assert dag_id in dag_bag.dags, "DAG ID not found in dag_bag.dags" + assert not dag_bag.import_errors, "Import errors found in DagBag"