Skip to content

Commit

Permalink
Fix schedule_interval value in test config
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajkoti committed Oct 14, 2024
1 parent 83cac19 commit e8cb297
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions tests/test_dagfactory.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import datetime
import logging
import os

import pytest
from airflow import __version__ as AIRFLOW_VERSION
from airflow.models.variable import Variable
from packaging import version
from airflow import __version__ as AIRFLOW_VERSION

here = os.path.dirname(__file__)

Expand All @@ -14,12 +14,8 @@
TEST_DAG_FACTORY = os.path.join(here, "fixtures/dag_factory.yml")
INVALID_YAML = os.path.join(here, "fixtures/invalid_yaml.yml")
INVALID_DAG_FACTORY = os.path.join(here, "fixtures/invalid_dag_factory.yml")
DAG_FACTORY_KUBERNETES_POD_OPERATOR = os.path.join(
here, "fixtures/dag_factory_kubernetes_pod_operator.yml"
)
DAG_FACTORY_VARIABLES_AS_ARGUMENTS = os.path.join(
here, "fixtures/dag_factory_variables_as_arguments.yml"
)
DAG_FACTORY_KUBERNETES_POD_OPERATOR = os.path.join(here, "fixtures/dag_factory_kubernetes_pod_operator.yml")
DAG_FACTORY_VARIABLES_AS_ARGUMENTS = os.path.join(here, "fixtures/dag_factory_variables_as_arguments.yml")

DOC_MD_FIXTURE_FILE = os.path.join(here, "fixtures/mydocfile.md")
DOC_MD_PYTHON_CALLABLE_FILE = os.path.join(here, "fixtures/doc_md_builder.py")
Expand All @@ -32,7 +28,7 @@
"end_date": "2020-01-01",
},
"default_view": "graph",
"schedule_interval": "daily",
"schedule_interval": "@daily",
},
"example_dag": {
"tasks": {
Expand Down Expand Up @@ -361,10 +357,7 @@ def test_doc_md_callable():
td = dagfactory.DagFactory(TEST_DAG_FACTORY)
td.generate_dags(globals())
expected_doc_md = globals()["example_dag3"].doc_md
assert (
str(td.get_dag_configs()["example_dag3"]["doc_md_python_arguments"])
== expected_doc_md
)
assert str(td.get_dag_configs()["example_dag3"]["doc_md_python_arguments"]) == expected_doc_md


def test_schedule_interval():
Expand All @@ -383,7 +376,7 @@ def test_dagfactory_dict():
"end_date": "2020-01-01",
},
"default_view": "graph",
"schedule_interval": "daily",
"schedule_interval": "@daily",
}
expected_dag = {
"example_dag": {
Expand All @@ -404,9 +397,7 @@ def test_dagfactory_dict():
def test_dagfactory_dict_and_yaml():
error_message = "Either `config_filepath` or `config` should be provided"
with pytest.raises(AssertionError, match=error_message):
dagfactory.DagFactory(
config_filepath=TEST_DAG_FACTORY, config=DAG_FACTORY_CONFIG
)
dagfactory.DagFactory(config_filepath=TEST_DAG_FACTORY, config=DAG_FACTORY_CONFIG)


def test_get_dag_configs_dict():
Expand Down Expand Up @@ -439,7 +430,7 @@ def test_load_invalid_yaml_logs_error(caplog):
dags_folder="tests/fixtures",
suffix=["invalid_yaml.yml"],
)
assert caplog.messages == ['Failed to load dag from tests/fixtures/invalid_yaml.yml']
assert caplog.messages == ["Failed to load dag from tests/fixtures/invalid_yaml.yml"]


def test_load_yaml_dags_succeed():
Expand Down

0 comments on commit e8cb297

Please sign in to comment.