From e1ca400830d478c405f254953bb37e86958d9d1c Mon Sep 17 00:00:00 2001 From: Ephraim Anierobi Date: Thu, 19 Oct 2023 09:45:54 +0100 Subject: [PATCH] update the listener serialization --- .../api_connexion/endpoints/test_plugin_endpoint.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/api_connexion/endpoints/test_plugin_endpoint.py b/tests/api_connexion/endpoints/test_plugin_endpoint.py index 42de5efc4aaaa..6a941d69977e3 100644 --- a/tests/api_connexion/endpoints/test_plugin_endpoint.py +++ b/tests/api_connexion/endpoints/test_plugin_endpoint.py @@ -16,6 +16,8 @@ # under the License. from __future__ import annotations +import inspect + import pytest from flask import Blueprint from flask_appbuilder import BaseView @@ -82,6 +84,10 @@ def next_dagrun_info( pass +class MyCustomListener: + pass + + class MockPlugin(AirflowPlugin): name = "mock_plugin" flask_blueprints = [bp] @@ -93,7 +99,7 @@ class MockPlugin(AirflowPlugin): macros = [plugin_macro] ti_deps = [ti_dep] timetables = [CustomTimetable] - listeners = [pytest] # using pytest here because we need a module(just for test) + listeners = [pytest, MyCustomListener()] # using pytest here because we need a module(just for test) @pytest.fixture(scope="module") @@ -147,7 +153,10 @@ def test_get_plugins_return_200(self): "name": "test_plugin", "timetables": [qualname(CustomTimetable)], "ti_deps": [str(ti_dep)], - "listeners": [pytest.__name__], + "listeners": [ + d.__name__ if inspect.ismodule(d) else qualname(d) + for d in [pytest, MyCustomListener()] + ], } ], "total_entries": 1,