diff --git a/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py b/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py index f94e4de691d97..5660ec5d87c02 100644 --- a/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py +++ b/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py @@ -81,6 +81,16 @@ class AwsAuthManager(BaseAuthManager): """ def __init__(self, appbuilder: AirflowAppBuilder) -> None: + from packaging.version import Version + + from airflow.version import version + + # TODO: remove this if block when min_airflow_version is set to higher than 2.9.0 + if Version(version) < Version("2.9"): + raise AirflowOptionalProviderFeatureException( + "``AwsAuthManager`` is compatible with Airflow versions >= 2.9." + ) + super().__init__(appbuilder) self._check_avp_schema_version() diff --git a/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py b/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py index 03684e6336384..a4a9472000708 100644 --- a/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py +++ b/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py @@ -23,7 +23,7 @@ from flask import Flask, session from flask_appbuilder.menu import MenuItem -from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS +from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS, AIRFLOW_V_2_9_PLUS try: from airflow.auth.managers.models.resource_details import ( @@ -66,6 +66,8 @@ if TYPE_CHECKING: from airflow.auth.managers.base_auth_manager import ResourceMethod +pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+") + mock = Mock() SAML_METADATA_PARSED = { diff --git a/tests/providers/amazon/aws/auth_manager/views/test_auth.py b/tests/providers/amazon/aws/auth_manager/views/test_auth.py index 7474d74727fd7..7db5ad7910db1 100644 --- a/tests/providers/amazon/aws/auth_manager/views/test_auth.py +++ b/tests/providers/amazon/aws/auth_manager/views/test_auth.py @@ -23,12 +23,12 @@ from airflow.exceptions import AirflowException from airflow.www import app as application -from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS +from tests.test_utils.compat import AIRFLOW_V_2_9_PLUS from tests.test_utils.config import conf_vars pytest.importorskip("onelogin") -pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_8_PLUS, reason="Test requires Airflow 2.8+") +pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+") SAML_METADATA_URL = "/saml/metadata"