From 190fab3728417a9df2d6d4fbb8e10da931c9f717 Mon Sep 17 00:00:00 2001 From: pierrejeambrun Date: Wed, 28 May 2025 18:37:05 +0200 Subject: [PATCH 1/2] Fix widget error for core hooks --- .../api_fastapi/core_api/services/ui/connections.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py index 07d1186d6fabe..118315f8032f5 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py @@ -116,9 +116,9 @@ class MockAnyWidget: """Mock any flask appbuilder widget.""" @staticmethod - def _get_hooks_with_mocked_fab() -> tuple[ - MutableMapping[str, HookInfo | None], dict[str, ConnectionFormWidgetInfo], dict[str, dict] - ]: + def _get_hooks_with_mocked_fab() -> ( + tuple[MutableMapping[str, HookInfo | None], dict[str, ConnectionFormWidgetInfo], dict[str, dict]] + ): """Get hooks with all details w/o FAB needing to be installed.""" from unittest import mock @@ -185,7 +185,9 @@ def mock_any_of(allowed_values: list) -> HookMetaService.MockEnum: pass pm = ProvidersManager() - return pm.hooks, pm.connection_form_widgets, pm.field_behaviours + pm._cleanup() # Remove any cached hooks with non mocked FAB + pm._init_airflow_core_hooks() # Initialize core hooks + return pm.hooks, pm.connection_form_widgets, pm.field_behaviours # Will init providers hooks return ( {}, From 25843c65a531d899ec30cc26e7137bb4e7f3f9dd Mon Sep 17 00:00:00 2001 From: pierrejeambrun Date: Mon, 2 Jun 2025 14:59:49 +0200 Subject: [PATCH 2/2] Fix CI --- .../airflow/api_fastapi/core_api/services/ui/connections.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py index 118315f8032f5..68881ac0f108e 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py @@ -116,9 +116,9 @@ class MockAnyWidget: """Mock any flask appbuilder widget.""" @staticmethod - def _get_hooks_with_mocked_fab() -> ( - tuple[MutableMapping[str, HookInfo | None], dict[str, ConnectionFormWidgetInfo], dict[str, dict]] - ): + def _get_hooks_with_mocked_fab() -> tuple[ + MutableMapping[str, HookInfo | None], dict[str, ConnectionFormWidgetInfo], dict[str, dict] + ]: """Get hooks with all details w/o FAB needing to be installed.""" from unittest import mock