Skip to content

Instantly share code, notes, and snippets.

@goodbyegangster
Created August 4, 2022 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goodbyegangster/0664470a7ae6de217b88d5cb53f10f6b to your computer and use it in GitHub Desktop.
Save goodbyegangster/0664470a7ae6de217b88d5cb53f10f6b to your computer and use it in GitHub Desktop.
import pytest
import pprint
from airflow.models import DagBag
class TestDag:
@pytest.fixture()
def dagbag(self):
return DagBag()
def test_dag_validation(self, dagbag):
dag = dagbag.get_dag(dag_id="sample_test_dag")
assert dagbag.import_errors == {}
assert dag is not None
assert dag.catchup is False
assert dag.doc_md != ""
print(type(dag))
pprint.pprint(vars(dag))
tasks = dag.tasks
task_ids = list(map(lambda task: task.task_id, tasks))
print(f"tasks: {task_ids}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment