This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 224cb75be1 Make `AwsAuthManager` compatible with only Airflow >= 2.9 
(#40690)
224cb75be1 is described below

commit 224cb75be10f71e34b4a81a9f4b7ed43f2f25db6
Author: Vincent <[email protected]>
AuthorDate: Wed Jul 10 12:01:23 2024 -0400

    Make `AwsAuthManager` compatible with only Airflow >= 2.9 (#40690)
---
 airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py  | 10 ++++++++++
 .../providers/amazon/aws/auth_manager/test_aws_auth_manager.py |  4 +++-
 tests/providers/amazon/aws/auth_manager/views/test_auth.py     |  4 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

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 f94e4de691..5660ec5d87 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 03684e6336..a4a9472000 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 @@ import pytest
 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 @@ from tests.test_utils.www import check_content_in_response
 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 7474d74727..7db5ad7910 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 flask import session, url_for
 
 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"

Reply via email to