Skip to content

Commit 1939daa

Browse files
potiukutkarsharma2
authored andcommitted
Skip example importability tests for providers in non-main branches (#43260) (#43263)
When "Always" tests are running in v2* branches, they also tested provider examples for importability. However sometimes those tests failed because we have not cherry-picked some of the provider's changes that were necessary for the examples to get imported. This PR excludes provider's examples from the "always" running importability tests, when the branch we are running it in is not main (i.e. we are in one of the past v2-branches). (cherry picked from commit 0f38be1)
1 parent 83184c6 commit 1939daa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/always/test_example_dags.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def get_python_excluded_providers_folders() -> list[str]:
121121

122122
def example_not_excluded_dags(xfail_db_exception: bool = False):
123123
example_dirs = ["airflow/**/example_dags/example_*.py", "tests/system/**/example_*.py"]
124+
124125
suspended_providers_folders = get_suspended_providers_folders()
125126
current_python_excluded_providers_folders = get_python_excluded_providers_folders()
126127
suspended_providers_folders = [
@@ -135,7 +136,13 @@ def example_not_excluded_dags(xfail_db_exception: bool = False):
135136
]
136137
providers_folders = tuple([AIRFLOW_SOURCES_ROOT.joinpath(pp).as_posix() for pp in PROVIDERS_PREFIXES])
137138

139+
default_branch = os.environ.get("DEFAULT_BRANCH", "main")
140+
include_providers = default_branch == "main"
141+
138142
for example_dir in example_dirs:
143+
if not include_providers and "providers/" in example_dir:
144+
print(f"Skipping {example_dir} because providers are not included for {default_branch} branch.")
145+
continue
139146
candidates = glob(f"{AIRFLOW_SOURCES_ROOT.as_posix()}/{example_dir}", recursive=True)
140147
for candidate in sorted(candidates):
141148
param_marks = []

0 commit comments

Comments
 (0)