Skip to content

Commit

Permalink
change chap9 code for flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
ssupecial committed Oct 12, 2024
1 parent e76db4a commit c246362
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions airflow/chap9/dags/bash_command.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from airflow import DAG
from airflow import DAG
from airflow.operators.bash import BashOperator
import datetime as dt
with DAG(
dag_id="bash_command",
start_date=dt.datetime(2024, 10,11),
start_date=dt.datetime(2024, 10, 11),
schedule_interval="@once"
):
BashOperator(
task_id="this_should_fail"
)
)
2 changes: 1 addition & 1 deletion airflow/chap9/dags/cycle_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
t2 = DummyOperator(task_id="t2")
t3 = DummyOperator(task_id="t3")

t1 >> t2 >> t3 >> t1
t1 >> t2 >> t3 >> t1
10 changes: 6 additions & 4 deletions airflow/chap9/tests/dags/test_dag_integrity.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import glob
import importlib.util
import os
import os

import pytest
from airflow.models import DAG
from airflow.models import DAG
from airflow.utils.dag_cycle_tester import check_cycle

DAG_PATH = os.path.join(
os.path.dirname(__file__), "..", "..", "dags/**/*.py"
)
DAG_FILES = glob.glob(DAG_PATH, recursive=True)


@pytest.mark.parametrize("dag_file", DAG_FILES)
def test_dag_integrity(dag_file):
module_name, _ = os.path.splitext(dag_file)
Expand All @@ -19,9 +20,10 @@ def test_dag_integrity(dag_file):
module = importlib.util.module_from_spec(mod_spec)
mod_spec.loader.exec_module(module)

dag_objects = [var for var in vars(module).values() if isinstance(var, DAG)]
dag_objects = [var for var in vars(module).values()
if isinstance(var, DAG)]
assert dag_objects

for dag in dag_objects:
# Test cycles
check_cycle(dag)
check_cycle(dag)

0 comments on commit c246362

Please sign in to comment.