diff --git a/tests/serialization/test_dag_serialization.py b/tests/serialization/test_dag_serialization.py index 2cd65462ed72f..69bd5259d7e51 100644 --- a/tests/serialization/test_dag_serialization.py +++ b/tests/serialization/test_dag_serialization.py @@ -1067,10 +1067,13 @@ def test_extra_serialized_field_and_operator_links( assert "https://www.google.com" == link @pytest.mark.usefixtures("clear_all_logger_handlers") - def test_extra_operator_links_logs_error_for_non_registered_extra_links(self, caplog): + def test_extra_operator_links_logs_error_for_non_registered_extra_links(self): """ Assert OperatorLinks not registered via Plugins and if it is not an inbuilt Operator Link, - it can still deserialize the DAG (does not error) but just logs an error + it can still deserialize the DAG (does not error) but just logs an error. + + We test NOT using caplog as this is flaky, we check that the task after deserialize + is missing the extra links. """ class TaskStateLink(BaseOperatorLink): @@ -1094,13 +1097,8 @@ def execute(self, context: Context): serialized_dag = SerializedDAG.to_dict(dag) - with caplog.at_level("ERROR", logger="airflow.serialization.serialized_objects"): - SerializedDAG.from_dict(serialized_dag) - - expected_err_msg = ( - "Operator Link class 'tests.serialization.test_dag_serialization.TaskStateLink' not registered" - ) - assert expected_err_msg in caplog.text + sdag = SerializedDAG.from_dict(serialized_dag) + assert sdag.task_dict["blah"].operator_extra_links == [] class ClassWithCustomAttributes: """