From 55e6a4d80e14c7a2ef53b1c00f2002cd1dc75721 Mon Sep 17 00:00:00 2001 From: Joao Amaral <7281460+joaopamaral@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:05:11 -0300 Subject: [PATCH] Fix: Tests after #41549 (Keep compatibility with old FAB versions) --- tests/serialization/test_dag_serialization.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/serialization/test_dag_serialization.py b/tests/serialization/test_dag_serialization.py index 277923423e2c6..d7f09c20ff9d3 100644 --- a/tests/serialization/test_dag_serialization.py +++ b/tests/serialization/test_dag_serialization.py @@ -40,6 +40,7 @@ import pytest from dateutil.relativedelta import FR, relativedelta from kubernetes.client import models as k8s +from packaging import version as packaging_version import airflow from airflow.datasets import Dataset @@ -58,6 +59,7 @@ from airflow.operators.bash import BashOperator from airflow.operators.empty import EmptyOperator from airflow.providers.cncf.kubernetes.pod_generator import PodGenerator +from airflow.providers.fab import __version__ as FAB_VERSION from airflow.security import permissions from airflow.sensors.bash import BashSensor from airflow.serialization.dag_dependency import DagDependency @@ -246,6 +248,11 @@ def detect_task_dependencies(task: Operator) -> DagDependency | None: # type: i } }, } + if packaging_version.parse(FAB_VERSION) >= packaging_version.parse("1.3.0") + else { + "__type": "set", + "__var": [permissions.ACTION_CAN_READ, permissions.ACTION_CAN_EDIT], + } }, }, "edge_info": {},