Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from airflow.utils.file import list_py_file_paths

import system.standard
from tests_common.pytest_plugin import AIRFLOW_ROOT_PATH
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, parse_and_sync_to_db

Expand All @@ -34,14 +34,18 @@
TEST_DAG_FOLDER_INVALID = "/invalid/path"
TEST_DAG_FOLDER_INVALID_2 = "/root/airflow/tests/dags/"

STANDARD_PROVIDER_SYSTEM_TESTS_PATH = (
AIRFLOW_ROOT_PATH / "providers" / "standard" / "tests" / "system" / "standard"
)


def get_corresponding_dag_file_count(dir: str, include_examples: bool = True) -> int:
from airflow import example_dags

return (
len(list_py_file_paths(directory=dir))
+ (len(list_py_file_paths(next(iter(example_dags.__path__)))) if include_examples else 0)
+ (len(list_py_file_paths(next(iter(system.standard.__path__)))) if include_examples else 0)
+ (len(list_py_file_paths(STANDARD_PROVIDER_SYSTEM_TESTS_PATH.as_posix())) if include_examples else 0)
)


Expand Down