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
21 changes: 13 additions & 8 deletions tests/always/test_example_dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def get_python_excluded_providers_folders() -> list[str]:


def example_not_excluded_dags(xfail_db_exception: bool = False):
example_dirs = ["airflow/**/example_dags/example_*.py", "tests/system/**/example_*.py"]
example_dirs = [
"airflow/**/example_dags/example_*.py",
"tests/system/**/example_*.py",
"providers/**/example_*.py",
]

default_branch = os.environ.get("DEFAULT_BRANCH", "main")
include_providers = default_branch == "main"

suspended_providers_folders = get_suspended_providers_folders()
current_python_excluded_providers_folders = get_python_excluded_providers_folders()
Expand All @@ -129,14 +136,7 @@ def example_not_excluded_dags(xfail_db_exception: bool = False):
for provider in current_python_excluded_providers_folders
]
providers_folders = tuple([AIRFLOW_SOURCES_ROOT.joinpath(pp).as_posix() for pp in PROVIDERS_PREFIXES])

default_branch = os.environ.get("DEFAULT_BRANCH", "main")
include_providers = default_branch == "main"

for example_dir in example_dirs:
if not include_providers and "providers/" in example_dir:
print(f"Skipping {example_dir} because providers are not included for {default_branch} branch.")
continue
candidates = glob(f"{AIRFLOW_SOURCES_ROOT.as_posix()}/{example_dir}", recursive=True)
for candidate in sorted(candidates):
param_marks = []
Expand All @@ -157,6 +157,11 @@ def example_not_excluded_dags(xfail_db_exception: bool = False):
param_marks.append(pytest.mark.skip(reason=reason))

if candidate.startswith(providers_folders):
if not include_providers:
print(
f"Skipping {candidate} because providers are not included for {default_branch} branch."
)
continue
# Do not raise an error for airflow.exceptions.RemovedInAirflow3Warning.
# We should not rush to enforce new syntax updates in providers
# because a version of Airflow that deprecates certain features may not yet be released.
Expand Down