Skip to content

Commit

Permalink
Rename examples and add simple system test
Browse files Browse the repository at this point in the history
  • Loading branch information
feluelle committed Jul 7, 2020
1 parent 96f9720 commit 4fda74f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ dev/scripts/airflow_operators.json
dev/scripts/diagrams_nodes.json

dist
airflow_diagrams.egg-info
airflow_diagrams.egg-info

.idea
build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ This will create a file called `diagram.py` which contains the definition to cre

Run this file and you will get a rendered diagram.

A working example can be found in [examples](examples) with the [test_dag](examples/dags/test_dag.py) generating the
[diagram](examples/diagrams/test_dag.py) ([rendered](examples/diagrams/test_dag.png) version).
A working example can be found in [examples](examples) with the [example_dag](examples/dags/example_dag.py) generating
the [diagram](examples/diagrams/example_dag.py) ([rendered](examples/diagrams/example_dag.png) version).

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion examples/dags/test_dag.py → examples/dags/example_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from airflow_diagrams import generate_diagram_from_dag

with DAG('test_dag', schedule_interval=None, default_args=dict(start_date=days_ago(2))) as dag:
with DAG('example_dag', schedule_interval=None, default_args=dict(start_date=days_ago(2))) as dag:
DummyOperator(task_id='run_this_1') >> [
DummyOperator(task_id='run_this_2a'), DummyOperator(task_id='run_this_2b')
] >> DummyOperator(task_id='run_this_3')
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from diagrams import Diagram
from diagrams.generic.blank import Blank

with Diagram("test_dag", show=False):
with Diagram("example_dag", show=False):
run_this_1 = Blank("run_this_1")
run_this_2b = Blank("run_this_2b")
run_this_3 = Blank("run_this_3")
run_this_2a = Blank("run_this_2a")
run_this_3 = Blank("run_this_3")
run_this_2b = Blank("run_this_2b")

run_this_1 >> run_this_2b
run_this_2b >> run_this_3
run_this_1 >> run_this_2a
run_this_2a >> run_this_3
run_this_1 >> run_this_2b
run_this_2b >> run_this_3

11 changes: 11 additions & 0 deletions tests/test_airflow_diagrams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import subprocess
import unittest


class TestAirflowDiagrams(unittest.TestCase):
def test_run_example_dag(self):
subprocess.call(['python', 'examples/dags/example_dag.py'])


if __name__ == '__main__':
unittest.main()

0 comments on commit 4fda74f

Please sign in to comment.