From 2bbe1eedc4c23f264455d1804e5aa22ab81c9508 Mon Sep 17 00:00:00 2001 From: jroach-astronomer Date: Wed, 30 Oct 2024 07:34:25 -0400 Subject: [PATCH] Updating tests, registering mark --- dev/dags/dags | 1 - dev/dags/example_callbacks.yml | 21 ++++++++++----------- pyproject.toml | 2 +- tests/test_example_dags.py | 2 ++ 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 120000 dev/dags/dags diff --git a/dev/dags/dags b/dev/dags/dags deleted file mode 120000 index 314da8b..0000000 --- a/dev/dags/dags +++ /dev/null @@ -1 +0,0 @@ -../dev/dags \ No newline at end of file diff --git a/dev/dags/example_callbacks.yml b/dev/dags/example_callbacks.yml index 8118998..097c76d 100644 --- a/dev/dags/example_callbacks.yml +++ b/dev/dags/example_callbacks.yml @@ -2,20 +2,19 @@ example_callbacks: default_args: start_date: "2024-01-01" on_failure_callback: - callback: customized.callbacks.custom_callbacks.output_message - param1: param1 - param2: param2 + callback: airflow.providers.slack.notifications.slack.send_slack_notification + slack_conn_id: slack_conn_id + text: | + :red_circle: Task Failed. + This task has failed and needs to be addressed. + Please remediate this issue ASAP. + channel: "#channel" schedule_interval: "@daily" catchup: False on_failure_callback: - callback: airflow.providers.slack.notifications.slack.send_slack_notification - slack_conn_id: slack_conn_id - text: | - :red_circle: Task Failed. - This task has failed and needs to be addressed. - Please remediate this issue ASAP. - channel: "#channel" - username: username + callback: customized.callbacks.custom_callbacks.output_message + param1: param1 + param2: param2 tasks: start: operator: airflow.operators.python.PythonOperator diff --git a/pyproject.toml b/pyproject.toml index cd5dc3f..bb2a1e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ universal = true [tool.pytest.ini_options] filterwarnings = ["ignore::DeprecationWarning"] minversion = "6.0" -markers = ["integration"] +markers = ["integration", "callbacks"] ###################################### # THIRD PARTY TOOLS diff --git a/tests/test_example_dags.py b/tests/test_example_dags.py index 758b984..87972fe 100644 --- a/tests/test_example_dags.py +++ b/tests/test_example_dags.py @@ -54,9 +54,11 @@ def get_dag_bag() -> DagBag: print(f"Adding {dagfile} to .airflowignore") file.writelines([f"{dagfile}\n"]) + # Print the contents of the .airflowignore file, and build the DagBag print(".airflowignore contents: ") print(AIRFLOW_IGNORE_FILE.read_text()) db = DagBag(EXAMPLE_DAGS_DIR, include_examples=False) + assert db.dags assert not db.import_errors return db