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

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 19576f3225 Restructuring PR classification for providers with misc 
changes (#40646)
19576f3225 is described below

commit 19576f32254f7b6cec78cb2db55e40f3d8b59743
Author: Amogh Desai <[email protected]>
AuthorDate: Mon Jul 8 15:35:52 2024 +0530

    Restructuring PR classification for providers with misc changes (#40646)
    
    * Restructuring PR classification for providers with misc changes
    
    * updating the UT
---
 .../prepare_providers/provider_documentation.py         | 17 ++++++++++-------
 dev/breeze/tests/test_provider_documentation.py         | 13 +++++++++----
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py 
b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
index 88f932a695..8b90a6395a 100644
--- a/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
+++ b/dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
@@ -108,16 +108,18 @@ class TypeOfChange(Enum):
     FEATURE = "f"
     BREAKING_CHANGE = "x"
     SKIP = "s"
+    MISC = "m"
 
 
 # defines the precedence order for provider version bumps
-# BREAKING_CHANGE > FEATURE > BUGFIX > DOCUMENTATION > SKIP
+# BREAKING_CHANGE > FEATURE > BUGFIX > MISC > DOCUMENTATION > SKIP
 precedence_order = {
     TypeOfChange.SKIP: 0,
     TypeOfChange.DOCUMENTATION: 1,
-    TypeOfChange.BUGFIX: 2,
-    TypeOfChange.FEATURE: 3,
-    TypeOfChange.BREAKING_CHANGE: 4,
+    TypeOfChange.MISC: 2,
+    TypeOfChange.BUGFIX: 3,
+    TypeOfChange.FEATURE: 4,
+    TypeOfChange.BREAKING_CHANGE: 5,
 }
 
 
@@ -428,7 +430,7 @@ def _ask_the_user_for_the_type_of_changes(non_interactive: 
bool) -> TypeOfChange
     while True:
         get_console().print(
             "[warning]Type of change (b)ugfix, (f)eature, (x)breaking "
-            f"change, (s)kip, (q)uit [{display_answers}]?[/] ",
+            f"change, (m)misc, (s)kip, (q)uit [{display_answers}]?[/] ",
             end="",
         )
         try:
@@ -899,13 +901,14 @@ def _get_changes_classified(
 
         if type_of_change == TypeOfChange.BUGFIX:
             classified_changes.fixes.append(change)
+        elif type_of_change == TypeOfChange.MISC:
+            classified_changes.misc.append(change)
         elif type_of_change == TypeOfChange.FEATURE and 
maybe_with_new_features:
             classified_changes.features.append(change)
         elif type_of_change == TypeOfChange.BREAKING_CHANGE and 
with_breaking_changes:
             classified_changes.breaking_changes.append(change)
         else:
-            # for the changes we do not have a category for, add it to misc
-            classified_changes.misc.append(change)
+            classified_changes.other.append(change)
     return classified_changes
 
 
diff --git a/dev/breeze/tests/test_provider_documentation.py 
b/dev/breeze/tests/test_provider_documentation.py
index 19fbdbb9b1..e2de9fee9f 100644
--- a/dev/breeze/tests/test_provider_documentation.py
+++ b/dev/breeze/tests/test_provider_documentation.py
@@ -236,11 +236,12 @@ def generate_short_hash():
 
 @pytest.mark.parametrize(
     "descriptions, with_breaking_changes, maybe_with_new_features,"
-    "breaking_count, feature_count, bugfix_count, other_count, type_of_change",
+    "breaking_count, feature_count, bugfix_count, other_count, misc_count, 
type_of_change",
     [
-        (["Added feature x"], True, True, 0, 1, 0, 0, [TypeOfChange.FEATURE]),
-        (["Added feature x"], False, True, 0, 1, 0, 0, [TypeOfChange.FEATURE]),
-        (["Breaking change in"], True, True, 1, 0, 0, 0, 
[TypeOfChange.BREAKING_CHANGE]),
+        (["Added feature x"], True, True, 0, 1, 0, 0, 0, 
[TypeOfChange.FEATURE]),
+        (["Added feature x"], False, True, 0, 1, 0, 0, 0, 
[TypeOfChange.FEATURE]),
+        (["Breaking change in"], True, True, 1, 0, 0, 0, 0, 
[TypeOfChange.BREAKING_CHANGE]),
+        (["Misc change in"], False, False, 0, 0, 0, 0, 1, [TypeOfChange.MISC]),
         (
             ["Fix change in", "Breaking feature y"],
             True,
@@ -249,6 +250,7 @@ def generate_short_hash():
             0,
             1,
             0,
+            0,
             [TypeOfChange.BUGFIX, TypeOfChange.BREAKING_CHANGE],
         ),
     ],
@@ -261,6 +263,7 @@ def test_classify_changes_automatically(
     feature_count: int,
     bugfix_count: int,
     other_count: int,
+    misc_count: int,
     type_of_change: TypeOfChange,
 ):
     from airflow_breeze.prepare_providers.provider_documentation import 
SHORT_HASH_TO_TYPE_DICT
@@ -283,3 +286,5 @@ def test_classify_changes_automatically(
     assert len(classified_changes.features) == feature_count
     assert len(classified_changes.fixes) == bugfix_count
     assert len(classified_changes.other) == other_count
+    assert len(classified_changes.other) == other_count
+    assert len(classified_changes.misc) == misc_count

Reply via email to