This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v2-10-test by this push:
     new 728515cac8 Skip example importability tests for providers in non-main 
branches (#43260) (#43263)
728515cac8 is described below

commit 728515cac83c2c754f8665a686d356fb2cc933c6
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Oct 22 19:53:15 2024 +0200

    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 0f38be1f957d72dd8b6081e7f2381f82f513f78a)
---
 tests/always/test_example_dags.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/always/test_example_dags.py 
b/tests/always/test_example_dags.py
index b8e3edb99b..15fa6165cc 100644
--- a/tests/always/test_example_dags.py
+++ b/tests/always/test_example_dags.py
@@ -121,6 +121,7 @@ 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"]
+
     suspended_providers_folders = get_suspended_providers_folders()
     current_python_excluded_providers_folders = 
get_python_excluded_providers_folders()
     suspended_providers_folders = [
@@ -135,7 +136,13 @@ def example_not_excluded_dags(xfail_db_exception: bool = 
False):
     ]
     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 = []

Reply via email to