Skip to content

Commit

Permalink
Speed up integration tests (#732)
Browse files Browse the repository at this point in the history
Speed up the integration tests by caching the dag bag result.

Previously, for each parametrized dag run test, it would reparse all of
the dags, which takes a non-trivial amount of time to parse all of the
cosmos example dags.

On my local machine, the total time went from 1616s to 540s, which will
save a good amount of GH minutes 😃.
  • Loading branch information
jbandoro authored Dec 4, 2023
1 parent aea4ee7 commit a2c58f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_example_dags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from pathlib import Path
from functools import cache

import airflow
import pytest
Expand Down Expand Up @@ -37,6 +38,7 @@ def session():
return get_session()


@cache
def get_dag_bag() -> DagBag:
"""Create a DagBag by adding the files that are not supported to .airflowignore"""
with open(AIRFLOW_IGNORE_FILE, "w+") as file:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_example_dags_no_connections.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from pathlib import Path
from functools import cache

import airflow
import pytest
Expand All @@ -23,6 +24,7 @@
}


@cache
def get_dag_bag() -> DagBag:
"""Create a DagBag by adding the files that are not supported to .airflowignore"""
with open(AIRFLOW_IGNORE_FILE, "w+") as file:
Expand Down

0 comments on commit a2c58f5

Please sign in to comment.