hussein-awala commented on code in PR #30705:
URL: https://github.com/apache/airflow/pull/30705#discussion_r1170669657


##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -606,7 +606,43 @@ def parallel_test_types(self) -> str:
                     )
                     test_types_to_remove.add(test_type)
             current_test_types = current_test_types - test_types_to_remove
-        return " ".join(sorted(current_test_types))
+        for test_type in tuple(current_test_types):
+            if test_type == "Providers":
+                current_test_types.remove(test_type)
+                current_test_types.update(
+                    ("Providers[amazon]", "Providers[google]", 
"Providers[-amazon,google]")
+                )
+            elif test_type.startswith("Providers[") and "amazon" in test_type 
or "google" in test_type:
+                current_test_types.remove(test_type)
+                if "amazon" in test_type:
+                    current_test_types.add("Providers[amazon]")
+                if "google" in test_type:
+                    current_test_types.add("Providers[google]")
+                new_test_type = (
+                    test_type.replace("google", "")
+                    .replace("amazon", "")
+                    .replace(",,", ",")
+                    .replace("[,", "[")
+                    .replace(",]", "]")
+                )
+                if new_test_type != "Providers[]":
+                    current_test_types.add(new_test_type)
+
+        sorting_order = ["Core", "Providers[-amazon,google]", "Other", 
"Providers[amazon]", "WWW"]

Review Comment:
   I'm wondering if we can simplify this block and make it dynamic in case we 
want to add extra tests:
   ```python
   long_tests_types = {"amazon", "google"}
   
   for test_type in tuple(current_test_types):
       if test_type == "Providers":
           current_test_types.remove(test_type)
           current_test_types.update(
               [f"Providers[{long_test_type}]" for long_test_type in 
long_tests_types] + [f"Providers[-{long_tests_types.join(',')}"]
           )
       else:
           match = re.search(r"Providers\[(.+)\]", test_type)
           if not match:
               continue
           providers_tests = set(match.group(1).split(","))
           providers_to_exclude = providers_tests.intersection(long_tests_types)
           if not providers_to_exclude:
               # no long tests to exclude
               continue
           # delete the test from the current_test_types and add it as multiple 
tests
           current_test_types.remove(test_type)
           current_test_types.update([f"Providers[{execluded_provider}]" for 
execluded_provider in providers_to_exclude])
           remaining_providers = providers_tests - providers_to_exclude
           if remaining_providers:
               new_test_type = f"Providers[{','.join(remaining_providers)}]"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to