This is an automated email from the ASF dual-hosted git repository.
potiuk 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 a31188a3dc5 Extract version compatibility constant in tests to
version_compat (#44774)
a31188a3dc5 is described below
commit a31188a3dc59c0a0870dd53c5714dc5945821d7c
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Dec 8 17:12:42 2024 +0100
Extract version compatibility constant in tests to version_compat (#44774)
This is extracted out of #44686 - pre-requisite for consistency
check and consistency change to always use version_compat embedded in
providers and avoid mistakes with importing the compat from tests
in the providers code.
This is purely extraction of constants that use to be in compat module
to version_compat - which will make it easy to write the pre-commit
to check if version_compat from tests_modules is used accidentally.
---
contributing-docs/testing/unit_tests.rst | 4 +--
.../aws/auth_manager/test_aws_auth_manager.py | 2 +-
.../amazon/aws/auth_manager/views/test_auth.py | 2 +-
.../amazon/aws/executors/ecs/test_ecs_executor.py | 2 +-
providers/tests/amazon/aws/hooks/test_s3.py | 2 +-
providers/tests/amazon/aws/links/test_base_aws.py | 2 +-
.../amazon/aws/log/test_cloudwatch_task_handler.py | 2 +-
.../tests/amazon/aws/log/test_s3_task_handler.py | 2 +-
.../tests/amazon/aws/operators/test_athena.py | 2 +-
.../tests/amazon/aws/operators/test_datasync.py | 2 +-
providers/tests/amazon/aws/operators/test_dms.py | 2 +-
.../amazon/aws/operators/test_emr_add_steps.py | 2 +-
.../aws/operators/test_emr_create_job_flow.py | 2 +-
.../amazon/aws/operators/test_sagemaker_base.py | 2 +-
providers/tests/amazon/aws/sensors/test_s3.py | 2 +-
providers/tests/amazon/aws/transfers/test_base.py | 2 +-
.../amazon/aws/transfers/test_dynamodb_to_s3.py | 2 +-
.../tests/amazon/aws/transfers/test_mongo_to_s3.py | 2 +-
providers/tests/apache/hive/hooks/test_hive.py | 2 +-
.../apache/kylin/operators/test_kylin_cube.py | 2 +-
.../apache/spark/operators/test_spark_submit.py | 2 +-
providers/tests/celery/cli/test_celery_command.py | 2 +-
.../tests/celery/executors/test_celery_executor.py | 2 +-
.../kubernetes/log_handlers/test_log_handlers.py | 3 +-
.../kubernetes/operators/test_spark_kubernetes.py | 2 +-
.../tests/cncf/kubernetes/test_pod_generator.py | 2 +-
providers/tests/common/compat/lineage/test_hook.py | 2 +-
providers/tests/common/io/xcom/test_backend.py | 3 +-
providers/tests/common/sql/operators/test_sql.py | 2 +-
providers/tests/common/sql/sensors/test_sql.py | 2 +-
.../elasticsearch/log/test_es_task_handler.py | 2 +-
.../api/auth/backend/test_basic_auth.py | 2 +-
.../auth_manager/api/auth/backend/test_session.py | 2 +-
.../api_endpoints/test_asset_endpoint.py | 2 +-
.../fab/auth_manager/api_endpoints/test_auth.py | 2 +-
.../fab/auth_manager/api_endpoints/test_cors.py | 2 +-
.../api_endpoints/test_dag_endpoint.py | 2 +-
.../api_endpoints/test_dag_run_endpoint.py | 2 +-
.../api_endpoints/test_dag_source_endpoint.py | 2 +-
.../api_endpoints/test_dag_warning_endpoint.py | 2 +-
.../api_endpoints/test_event_log_endpoint.py | 2 +-
.../api_endpoints/test_import_error_endpoint.py | 3 +-
.../api_endpoints/test_task_instance_endpoint.py | 2 +-
.../api_endpoints/test_variable_endpoint.py | 2 +-
.../api_endpoints/test_xcom_endpoint.py | 2 +-
.../fab/auth_manager/views/test_permissions.py | 2 +-
.../fab/auth_manager/views/test_roles_list.py | 2 +-
.../tests/fab/auth_manager/views/test_user.py | 2 +-
.../tests/fab/auth_manager/views/test_user_edit.py | 2 +-
.../fab/auth_manager/views/test_user_stats.py | 2 +-
providers/tests/google/cloud/hooks/test_gcs.py | 2 +-
.../cloud/log/test_stackdriver_task_handler.py | 2 +-
.../google/cloud/operators/test_bigquery_dts.py | 2 +-
.../tests/google/cloud/operators/test_dataproc.py | 3 +-
.../common/auth_backend/test_google_openid.py | 2 +-
.../microsoft/azure/operators/test_data_factory.py | 2 +-
.../microsoft/azure/operators/test_msgraph.py | 2 +-
.../tests/microsoft/azure/sensors/test_msgraph.py | 2 +-
.../tests/openlineage/extractors/test_manager.py | 3 +-
.../tests/openlineage/plugins/test_adapter.py | 3 +-
.../tests/openlineage/plugins/test_execution.py | 2 +-
.../tests/openlineage/plugins/test_listener.py | 3 +-
providers/tests/openlineage/plugins/test_utils.py | 4 +--
.../tests/opensearch/log/test_os_task_handler.py | 2 +-
providers/tests/presto/hooks/test_presto.py | 2 +-
.../tests/redis/log/test_redis_task_handler.py | 2 +-
providers/tests/sftp/operators/test_sftp.py | 2 +-
providers/tests/smtp/notifications/test_smtp.py | 2 +-
.../tests/snowflake/operators/test_snowflake.py | 2 +-
providers/tests/standard/operators/test_bash.py | 2 +-
.../operators/test_latest_only_operator.py | 2 +-
providers/tests/standard/operators/test_python.py | 2 +-
.../tests/standard/triggers/test_external_task.py | 2 +-
.../tests/standard/utils/test_python_virtualenv.py | 2 +-
providers/tests/trino/hooks/test_trino.py | 2 +-
providers/tests/yandex/links/test_yq.py | 2 +-
providers/tests/yandex/operators/test_yq.py | 2 +-
.../endpoints/test_dag_run_endpoint.py | 2 +-
.../endpoints/test_extra_link_endpoint.py | 3 +-
tests/api_connexion/schemas/test_dag_run_schema.py | 2 +-
.../core_api/routes/public/test_extra_links.py | 3 +-
.../commands/remote_commands/test_task_command.py | 2 +-
tests/dag_processing/test_processor.py | 3 +-
tests/decorators/test_python.py | 2 +-
tests/jobs/test_local_task_job.py | 2 +-
tests/jobs/test_scheduler_job.py | 2 +-
tests/listeners/class_listener.py | 2 +-
tests/models/test_cleartasks.py | 2 +-
tests/models/test_dag.py | 2 +-
tests/models/test_dagrun.py | 2 +-
tests/models/test_taskinstance.py | 2 +-
tests/operators/test_branch_operator.py | 2 +-
tests/sensors/test_external_task_sensor.py | 2 +-
tests/task/test_standard_task_runner.py | 2 +-
tests/ti_deps/deps/test_prev_dagrun_dep.py | 2 +-
tests/utils/test_log_handlers.py | 2 +-
tests/utils/test_sqlalchemy.py | 2 +-
tests/utils/test_state.py | 2 +-
.../test_task_handler_with_custom_formatter.py | 2 +-
tests/utils/test_types.py | 2 +-
tests/www/test_utils.py | 2 +-
tests/www/views/test_views.py | 2 +-
tests/www/views/test_views_acl.py | 2 +-
tests/www/views/test_views_dagrun.py | 2 +-
tests/www/views/test_views_decorators.py | 2 +-
tests/www/views/test_views_extra_links.py | 3 +-
tests/www/views/test_views_log.py | 2 +-
tests/www/views/test_views_rendered.py | 3 +-
tests/www/views/test_views_tasks.py | 3 +-
tests_common/pytest_plugin.py | 8 +++---
tests_common/test_utils/compat.py | 12 ++------
tests_common/test_utils/db.py | 5 ++--
tests_common/test_utils/version_compat.py | 32 ++++++++++++++++++++++
113 files changed, 163 insertions(+), 129 deletions(-)
diff --git a/contributing-docs/testing/unit_tests.rst
b/contributing-docs/testing/unit_tests.rst
index 12a2403b9a7..9ad3d95d0dc 100644
--- a/contributing-docs/testing/unit_tests.rst
+++ b/contributing-docs/testing/unit_tests.rst
@@ -1103,12 +1103,12 @@ are not part of the public API. We deal with it in one
of the following ways:
you can add more if needed in a similar way.
3) If only some tests are not compatible and use features that are available
only in newer airflow version,
- we can mark those tests with appropriate ``AIRFLOW_V_2_X_PLUS`` boolean
constant defined in ``compat.py``
+ we can mark those tests with appropriate ``AIRFLOW_V_2_X_PLUS`` boolean
constant defined in ``version_compat.py``
For example:
.. code-block:: python
- from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
@pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="The tests should be
skipped for Airflow < 2.9")
diff --git a/providers/tests/amazon/aws/auth_manager/test_aws_auth_manager.py
b/providers/tests/amazon/aws/auth_manager/test_aws_auth_manager.py
index 04dfb77ae6f..bef9cc54048 100644
--- a/providers/tests/amazon/aws/auth_manager/test_aws_auth_manager.py
+++ b/providers/tests/amazon/aws/auth_manager/test_aws_auth_manager.py
@@ -48,8 +48,8 @@ from airflow.security.permissions import (
from airflow.www import app as application
from airflow.www.extensions.init_appbuilder import init_appbuilder
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import check_content_in_response
if TYPE_CHECKING:
diff --git a/providers/tests/amazon/aws/auth_manager/views/test_auth.py
b/providers/tests/amazon/aws/auth_manager/views/test_auth.py
index 71951a50e98..2857ab39e4b 100644
--- a/providers/tests/amazon/aws/auth_manager/views/test_auth.py
+++ b/providers/tests/amazon/aws/auth_manager/views/test_auth.py
@@ -24,8 +24,8 @@ from flask import session, url_for
from airflow.exceptions import AirflowException
from airflow.www import app as application
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires
Airflow 2.9+")
diff --git a/providers/tests/amazon/aws/executors/ecs/test_ecs_executor.py
b/providers/tests/amazon/aws/executors/ecs/test_ecs_executor.py
index 0158df0ca6e..4fd9ee9deea 100644
--- a/providers/tests/amazon/aws/executors/ecs/test_ecs_executor.py
+++ b/providers/tests/amazon/aws/executors/ecs/test_ecs_executor.py
@@ -58,8 +58,8 @@ from airflow.utils.timezone import utcnow
from airflow.version import version as airflow_version_str
from tests_common import RUNNING_TESTS_AGAINST_AIRFLOW_PACKAGES
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/amazon/aws/hooks/test_s3.py
b/providers/tests/amazon/aws/hooks/test_s3.py
index b4f0af43f05..d14a4e8698a 100644
--- a/providers/tests/amazon/aws/hooks/test_s3.py
+++ b/providers/tests/amazon/aws/hooks/test_s3.py
@@ -43,7 +43,7 @@ from airflow.providers.amazon.aws.hooks.s3 import (
)
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
@pytest.fixture
diff --git a/providers/tests/amazon/aws/links/test_base_aws.py
b/providers/tests/amazon/aws/links/test_base_aws.py
index 0b629905359..91240a512ab 100644
--- a/providers/tests/amazon/aws/links/test_base_aws.py
+++ b/providers/tests/amazon/aws/links/test_base_aws.py
@@ -26,8 +26,8 @@ from airflow.models.xcom import XCom
from airflow.providers.amazon.aws.links.base_aws import BaseAwsLink
from airflow.serialization.serialized_objects import SerializedDAG
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.mock_operators import MockOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if TYPE_CHECKING:
from airflow.models.taskinstance import TaskInstance
diff --git a/providers/tests/amazon/aws/log/test_cloudwatch_task_handler.py
b/providers/tests/amazon/aws/log/test_cloudwatch_task_handler.py
index 0e1693648f1..00ae11b90fa 100644
--- a/providers/tests/amazon/aws/log/test_cloudwatch_task_handler.py
+++ b/providers/tests/amazon/aws/log/test_cloudwatch_task_handler.py
@@ -36,8 +36,8 @@ from airflow.providers.amazon.aws.utils import
datetime_to_epoch_utc_ms
from airflow.utils.state import State
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
def get_time_str(time_in_milliseconds):
diff --git a/providers/tests/amazon/aws/log/test_s3_task_handler.py
b/providers/tests/amazon/aws/log/test_s3_task_handler.py
index 70e37ef03ba..dca9930c322 100644
--- a/providers/tests/amazon/aws/log/test_s3_task_handler.py
+++ b/providers/tests/amazon/aws/log/test_s3_task_handler.py
@@ -34,8 +34,8 @@ from airflow.providers.amazon.aws.log.s3_task_handler import
S3TaskHandler
from airflow.utils.state import State, TaskInstanceState
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
@pytest.fixture(autouse=True)
diff --git a/providers/tests/amazon/aws/operators/test_athena.py
b/providers/tests/amazon/aws/operators/test_athena.py
index b29f94bbebe..63bfa890699 100644
--- a/providers/tests/amazon/aws/operators/test_athena.py
+++ b/providers/tests/amazon/aws/operators/test_athena.py
@@ -42,7 +42,7 @@ from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
TEST_DAG_ID = "unit_tests"
DEFAULT_DATE = datetime(2018, 1, 1)
diff --git a/providers/tests/amazon/aws/operators/test_datasync.py
b/providers/tests/amazon/aws/operators/test_datasync.py
index ca909cb4854..272e03d201f 100644
--- a/providers/tests/amazon/aws/operators/test_datasync.py
+++ b/providers/tests/amazon/aws/operators/test_datasync.py
@@ -31,7 +31,7 @@ from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
TEST_DAG_ID = "unit_tests"
DEFAULT_DATE = datetime(2018, 1, 1)
diff --git a/providers/tests/amazon/aws/operators/test_dms.py
b/providers/tests/amazon/aws/operators/test_dms.py
index 8e51b34964f..9a522c525cb 100644
--- a/providers/tests/amazon/aws/operators/test_dms.py
+++ b/providers/tests/amazon/aws/operators/test_dms.py
@@ -36,7 +36,7 @@ from airflow.utils import timezone
from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
TASK_ARN = "test_arn"
diff --git a/providers/tests/amazon/aws/operators/test_emr_add_steps.py
b/providers/tests/amazon/aws/operators/test_emr_add_steps.py
index 7ce721be3e7..8bd2e9325d5 100644
--- a/providers/tests/amazon/aws/operators/test_emr_add_steps.py
+++ b/providers/tests/amazon/aws/operators/test_emr_add_steps.py
@@ -33,7 +33,7 @@ from airflow.utils import timezone
from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/tests/amazon/aws/operators/test_emr_create_job_flow.py
b/providers/tests/amazon/aws/operators/test_emr_create_job_flow.py
index 2bd6fa444f5..cc39fec5269 100644
--- a/providers/tests/amazon/aws/operators/test_emr_create_job_flow.py
+++ b/providers/tests/amazon/aws/operators/test_emr_create_job_flow.py
@@ -36,7 +36,7 @@ from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
from providers.tests.amazon.aws.utils.test_waiter import
assert_expected_waiter_type
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
TASK_ID = "test_task"
diff --git a/providers/tests/amazon/aws/operators/test_sagemaker_base.py
b/providers/tests/amazon/aws/operators/test_sagemaker_base.py
index 8be30dabd6f..f44e49ffc29 100644
--- a/providers/tests/amazon/aws/operators/test_sagemaker_base.py
+++ b/providers/tests/amazon/aws/operators/test_sagemaker_base.py
@@ -34,7 +34,7 @@ from airflow.utils import timezone
from airflow.utils.types import DagRunType
from providers.tests.amazon.aws.utils.test_template_fields import
validate_template_fields
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
CONFIG: dict = {
"key1": "1",
diff --git a/providers/tests/amazon/aws/sensors/test_s3.py
b/providers/tests/amazon/aws/sensors/test_s3.py
index 3112fdf4c59..8b241168392 100644
--- a/providers/tests/amazon/aws/sensors/test_s3.py
+++ b/providers/tests/amazon/aws/sensors/test_s3.py
@@ -32,7 +32,7 @@ from airflow.providers.amazon.aws.sensors.s3 import
S3KeySensor, S3KeysUnchanged
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = datetime(2015, 1, 1)
diff --git a/providers/tests/amazon/aws/transfers/test_base.py
b/providers/tests/amazon/aws/transfers/test_base.py
index 7c526c66e84..a09f08b0d18 100644
--- a/providers/tests/amazon/aws/transfers/test_base.py
+++ b/providers/tests/amazon/aws/transfers/test_base.py
@@ -25,7 +25,7 @@ from airflow.providers.amazon.aws.transfers.base import
AwsToAwsBaseOperator
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2020, 1, 1)
diff --git a/providers/tests/amazon/aws/transfers/test_dynamodb_to_s3.py
b/providers/tests/amazon/aws/transfers/test_dynamodb_to_s3.py
index e3da1d3ee45..7304492c1ad 100644
--- a/providers/tests/amazon/aws/transfers/test_dynamodb_to_s3.py
+++ b/providers/tests/amazon/aws/transfers/test_dynamodb_to_s3.py
@@ -33,7 +33,7 @@ from airflow.providers.amazon.aws.transfers.dynamodb_to_s3
import (
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
class TestJSONEncoder:
diff --git a/providers/tests/amazon/aws/transfers/test_mongo_to_s3.py
b/providers/tests/amazon/aws/transfers/test_mongo_to_s3.py
index c461cbc0465..4698469a650 100644
--- a/providers/tests/amazon/aws/transfers/test_mongo_to_s3.py
+++ b/providers/tests/amazon/aws/transfers/test_mongo_to_s3.py
@@ -26,7 +26,7 @@ from airflow.providers.amazon.aws.transfers.mongo_to_s3
import MongoToS3Operator
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
TASK_ID = "test_mongo_to_s3_operator"
MONGO_CONN_ID = "default_mongo"
diff --git a/providers/tests/apache/hive/hooks/test_hive.py
b/providers/tests/apache/hive/hooks/test_hive.py
index 387339c185e..c7913a9406c 100644
--- a/providers/tests/apache/hive/hooks/test_hive.py
+++ b/providers/tests/apache/hive/hooks/test_hive.py
@@ -42,7 +42,7 @@ from providers.tests.apache.hive import (
MockSubProcess,
)
from tests_common.test_utils.asserts import assert_equal_ignore_multiple_spaces
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2015, 1, 1)
DEFAULT_DATE_ISO = DEFAULT_DATE.isoformat()
diff --git a/providers/tests/apache/kylin/operators/test_kylin_cube.py
b/providers/tests/apache/kylin/operators/test_kylin_cube.py
index 7d7ddcc5ce8..b23833811f6 100644
--- a/providers/tests/apache/kylin/operators/test_kylin_cube.py
+++ b/providers/tests/apache/kylin/operators/test_kylin_cube.py
@@ -29,7 +29,7 @@ from airflow.providers.apache.kylin.operators.kylin_cube
import KylinCubeOperato
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2020, 1, 1)
diff --git a/providers/tests/apache/spark/operators/test_spark_submit.py
b/providers/tests/apache/spark/operators/test_spark_submit.py
index a6ba854826d..879a7c999ef 100644
--- a/providers/tests/apache/spark/operators/test_spark_submit.py
+++ b/providers/tests/apache/spark/operators/test_spark_submit.py
@@ -27,7 +27,7 @@ from airflow.providers.apache.spark.operators.spark_submit
import SparkSubmitOpe
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/tests/celery/cli/test_celery_command.py
b/providers/tests/celery/cli/test_celery_command.py
index 775194bccab..15f1fdc9b2f 100644
--- a/providers/tests/celery/cli/test_celery_command.py
+++ b/providers/tests/celery/cli/test_celery_command.py
@@ -31,8 +31,8 @@ from airflow.configuration import conf
from airflow.executors import executor_loader
from airflow.providers.celery.cli import celery_command
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/celery/executors/test_celery_executor.py
b/providers/tests/celery/executors/test_celery_executor.py
index aa8dddcb363..7dc918082b6 100644
--- a/providers/tests/celery/executors/test_celery_executor.py
+++ b/providers/tests/celery/executors/test_celery_executor.py
@@ -43,8 +43,8 @@ from airflow.utils import timezone
from airflow.utils.state import State
from tests_common.test_utils import db
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/cncf/kubernetes/log_handlers/test_log_handlers.py
b/providers/tests/cncf/kubernetes/log_handlers/test_log_handlers.py
index 1d875868f9a..f18a4b88eed 100644
--- a/providers/tests/cncf/kubernetes/log_handlers/test_log_handlers.py
+++ b/providers/tests/cncf/kubernetes/log_handlers/test_log_handlers.py
@@ -41,8 +41,9 @@ from airflow.utils.state import State, TaskInstanceState
from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, PythonOperator
+from tests_common.test_utils.compat import PythonOperator
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/cncf/kubernetes/operators/test_spark_kubernetes.py
b/providers/tests/cncf/kubernetes/operators/test_spark_kubernetes.py
index 784b2c80c38..51048278821 100644
--- a/providers/tests/cncf/kubernetes/operators/test_spark_kubernetes.py
+++ b/providers/tests/cncf/kubernetes/operators/test_spark_kubernetes.py
@@ -36,7 +36,7 @@ from airflow.providers.cncf.kubernetes.pod_generator import
MAX_LABEL_LEN
from airflow.utils import db, timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
@patch("airflow.providers.cncf.kubernetes.operators.spark_kubernetes.KubernetesHook")
diff --git a/providers/tests/cncf/kubernetes/test_pod_generator.py
b/providers/tests/cncf/kubernetes/test_pod_generator.py
index abfbe686b64..77166452410 100644
--- a/providers/tests/cncf/kubernetes/test_pod_generator.py
+++ b/providers/tests/cncf/kubernetes/test_pod_generator.py
@@ -37,7 +37,7 @@ from airflow.providers.cncf.kubernetes.pod_generator import (
)
from airflow.providers.cncf.kubernetes.secret import Secret
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
now = pendulum.now("UTC")
diff --git a/providers/tests/common/compat/lineage/test_hook.py
b/providers/tests/common/compat/lineage/test_hook.py
index 13bb2cca725..7b4759af844 100644
--- a/providers/tests/common/compat/lineage/test_hook.py
+++ b/providers/tests/common/compat/lineage/test_hook.py
@@ -20,7 +20,7 @@ import pytest
from airflow.providers.common.compat.lineage.hook import
get_hook_lineage_collector
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
def test_that_compat_does_not_raise():
diff --git a/providers/tests/common/io/xcom/test_backend.py
b/providers/tests/common/io/xcom/test_backend.py
index 81f9286a29c..3b8c6e82462 100644
--- a/providers/tests/common/io/xcom/test_backend.py
+++ b/providers/tests/common/io/xcom/test_backend.py
@@ -19,7 +19,8 @@ from __future__ import annotations
import pytest
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS,
ignore_provider_compatibility_error
+from tests_common.test_utils.compat import ignore_provider_compatibility_error
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git a/providers/tests/common/sql/operators/test_sql.py
b/providers/tests/common/sql/operators/test_sql.py
index 544fcb40b4d..85ab77a0aec 100644
--- a/providers/tests/common/sql/operators/test_sql.py
+++ b/providers/tests/common/sql/operators/test_sql.py
@@ -45,8 +45,8 @@ from airflow.utils import timezone
from airflow.utils.session import create_session
from airflow.utils.state import State
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.providers import get_provider_min_airflow_version
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/common/sql/sensors/test_sql.py
b/providers/tests/common/sql/sensors/test_sql.py
index add9c78dc7f..3e793f67c51 100644
--- a/providers/tests/common/sql/sensors/test_sql.py
+++ b/providers/tests/common/sql/sensors/test_sql.py
@@ -27,7 +27,7 @@ from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.common.sql.sensors.sql import SqlSensor
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Tests for
Airflow 2.8.0+ only")
diff --git a/providers/tests/elasticsearch/log/test_es_task_handler.py
b/providers/tests/elasticsearch/log/test_es_task_handler.py
index 1811c6eee63..f87d4ffb143 100644
--- a/providers/tests/elasticsearch/log/test_es_task_handler.py
+++ b/providers/tests/elasticsearch/log/test_es_task_handler.py
@@ -46,9 +46,9 @@ from airflow.utils.timezone import datetime
from providers.tests.elasticsearch.log.elasticmock import elasticmock
from providers.tests.elasticsearch.log.elasticmock.utilities import
SearchFailedException
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
diff --git
a/providers/tests/fab/auth_manager/api/auth/backend/test_basic_auth.py
b/providers/tests/fab/auth_manager/api/auth/backend/test_basic_auth.py
index 52281df0f99..9f93054ebee 100644
--- a/providers/tests/fab/auth_manager/api/auth/backend/test_basic_auth.py
+++ b/providers/tests/fab/auth_manager/api/auth/backend/test_basic_auth.py
@@ -25,7 +25,7 @@ from flask_appbuilder.const import AUTH_LDAP
from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import
requires_authentication
from airflow.www import app as application
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
pytestmark = [
pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Tests for Airflow
2.9.0+ only"),
diff --git a/providers/tests/fab/auth_manager/api/auth/backend/test_session.py
b/providers/tests/fab/auth_manager/api/auth/backend/test_session.py
index 4f157c032e2..0d1ffbb5bda 100644
--- a/providers/tests/fab/auth_manager/api/auth/backend/test_session.py
+++ b/providers/tests/fab/auth_manager/api/auth/backend/test_session.py
@@ -24,7 +24,7 @@ from flask import Response
from airflow.providers.fab.auth_manager.api.auth.backend.session import
requires_authentication
from airflow.www import app as application
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
pytestmark = [
pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Tests for Airflow
2.9.0+ only"),
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_asset_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_asset_endpoint.py
index b670063c7b3..79949b4cd8d 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_asset_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_asset_endpoint.py
@@ -26,8 +26,8 @@ from airflow.security import permissions
from airflow.utils import timezone
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_assets, clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import _check_last_log
try:
diff --git a/providers/tests/fab/auth_manager/api_endpoints/test_auth.py
b/providers/tests/fab/auth_manager/api_endpoints/test_auth.py
index 669e62dc0b3..4f8bc12702f 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_auth.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_auth.py
@@ -22,9 +22,9 @@ import pytest
from flask_login import current_user
from tests_common.test_utils.api_connexion_utils import assert_401
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_pools
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/fab/auth_manager/api_endpoints/test_cors.py
b/providers/tests/fab/auth_manager/api_endpoints/test_cors.py
index f9c27169e2f..b8947925b1e 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_cors.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_cors.py
@@ -20,9 +20,9 @@ from base64 import b64encode
import pytest
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_pools
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_dag_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_dag_endpoint.py
index a9a1cce4384..bd472712048 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_dag_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_dag_endpoint.py
@@ -30,8 +30,8 @@ from airflow.security import permissions
from airflow.utils.session import provide_session
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_serialized_dags
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import _check_last_log
pytestmark = [
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_dag_run_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_dag_run_endpoint.py
index 654dd7026fc..52c8bbca185 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_dag_run_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_dag_run_endpoint.py
@@ -33,8 +33,8 @@ from
providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import (
delete_roles,
delete_user,
)
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_serialized_dags
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
try:
from airflow.utils.types import DagRunTriggeredByType, DagRunType
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_dag_source_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_dag_source_endpoint.py
index c6d0fcb79c7..39fd6ed4445 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_dag_source_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_dag_source_endpoint.py
@@ -26,8 +26,8 @@ from airflow.models import DagBag
from airflow.security import permissions
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_dag_code, clear_db_dags,
clear_db_serialized_dags
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_dag_warning_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_dag_warning_endpoint.py
index e97c17167ef..e06146a988f 100644
---
a/providers/tests/fab/auth_manager/api_endpoints/test_dag_warning_endpoint.py
+++
b/providers/tests/fab/auth_manager/api_endpoints/test_dag_warning_endpoint.py
@@ -24,8 +24,8 @@ from airflow.security import permissions
from airflow.utils.session import create_session
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_dag_warnings, clear_db_dags
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_event_log_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_event_log_endpoint.py
index eba687cdf06..f5935dcd93c 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_event_log_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_event_log_endpoint.py
@@ -23,8 +23,8 @@ from airflow.security import permissions
from airflow.utils import timezone
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_logs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_import_error_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_import_error_endpoint.py
index 66da26f76bf..84b3cb8ed34 100644
---
a/providers/tests/fab/auth_manager/api_endpoints/test_import_error_endpoint.py
+++
b/providers/tests/fab/auth_manager/api_endpoints/test_import_error_endpoint.py
@@ -23,9 +23,10 @@ from airflow.security import permissions
from airflow.utils import timezone
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, ParseImportError
+from tests_common.test_utils.compat import ParseImportError
from tests_common.test_utils.db import clear_db_dags, clear_db_import_errors
from tests_common.test_utils.permissions import _resource_name
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_task_instance_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_task_instance_endpoint.py
index dd7dcfbaa34..5f755109a06 100644
---
a/providers/tests/fab/auth_manager/api_endpoints/test_task_instance_endpoint.py
+++
b/providers/tests/fab/auth_manager/api_endpoints/test_task_instance_endpoint.py
@@ -34,8 +34,8 @@ from
providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import (
delete_roles,
delete_user,
)
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs, clear_rendered_ti_fields
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_variable_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_variable_endpoint.py
index 5bc21d2dc37..954a2de130d 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_variable_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_variable_endpoint.py
@@ -22,8 +22,8 @@ from airflow.models import Variable
from airflow.security import permissions
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_variables
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git
a/providers/tests/fab/auth_manager/api_endpoints/test_xcom_endpoint.py
b/providers/tests/fab/auth_manager/api_endpoints/test_xcom_endpoint.py
index 545f40c91dd..fb46f52a402 100644
--- a/providers/tests/fab/auth_manager/api_endpoints/test_xcom_endpoint.py
+++ b/providers/tests/fab/auth_manager/api_endpoints/test_xcom_endpoint.py
@@ -31,8 +31,8 @@ from airflow.utils.session import create_session
from airflow.utils.types import DagRunType
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_xcom
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = [
pytest.mark.db_test,
diff --git a/providers/tests/fab/auth_manager/views/test_permissions.py
b/providers/tests/fab/auth_manager/views/test_permissions.py
index de083df6965..97f0ed08fcd 100644
--- a/providers/tests/fab/auth_manager/views/test_permissions.py
+++ b/providers/tests/fab/auth_manager/views/test_permissions.py
@@ -24,7 +24,7 @@ from airflow.www import app as application
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
from providers.tests.fab.auth_manager.views import
_assert_dataset_deprecation_warning
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/fab/auth_manager/views/test_roles_list.py
b/providers/tests/fab/auth_manager/views/test_roles_list.py
index 1b58fc123d8..436a85857c3 100644
--- a/providers/tests/fab/auth_manager/views/test_roles_list.py
+++ b/providers/tests/fab/auth_manager/views/test_roles_list.py
@@ -24,7 +24,7 @@ from airflow.www import app as application
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
from providers.tests.fab.auth_manager.views import
_assert_dataset_deprecation_warning
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/fab/auth_manager/views/test_user.py
b/providers/tests/fab/auth_manager/views/test_user.py
index c5ca91d728d..39707ad1c39 100644
--- a/providers/tests/fab/auth_manager/views/test_user.py
+++ b/providers/tests/fab/auth_manager/views/test_user.py
@@ -24,7 +24,7 @@ from airflow.www import app as application
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
from providers.tests.fab.auth_manager.views import
_assert_dataset_deprecation_warning
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/fab/auth_manager/views/test_user_edit.py
b/providers/tests/fab/auth_manager/views/test_user_edit.py
index e42780a971d..aa3c7d9fab6 100644
--- a/providers/tests/fab/auth_manager/views/test_user_edit.py
+++ b/providers/tests/fab/auth_manager/views/test_user_edit.py
@@ -24,7 +24,7 @@ from airflow.www import app as application
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
from providers.tests.fab.auth_manager.views import
_assert_dataset_deprecation_warning
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/fab/auth_manager/views/test_user_stats.py
b/providers/tests/fab/auth_manager/views/test_user_stats.py
index da5c5edf4d9..72a0c49fa6a 100644
--- a/providers/tests/fab/auth_manager/views/test_user_stats.py
+++ b/providers/tests/fab/auth_manager/views/test_user_stats.py
@@ -24,7 +24,7 @@ from airflow.www import app as application
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user, delete_user
from providers.tests.fab.auth_manager.views import
_assert_dataset_deprecation_warning
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.www import client_with_login
pytestmark = [
diff --git a/providers/tests/google/cloud/hooks/test_gcs.py
b/providers/tests/google/cloud/hooks/test_gcs.py
index 8dc5966e3d7..9f9467c9b95 100644
--- a/providers/tests/google/cloud/hooks/test_gcs.py
+++ b/providers/tests/google/cloud/hooks/test_gcs.py
@@ -44,7 +44,7 @@ from airflow.utils import timezone
from airflow.version import version
from providers.tests.google.cloud.utils.base_gcp_mock import
mock_base_gcp_hook_default_project_id
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
BASE_STRING = "airflow.providers.google.common.hooks.base_google.{}"
GCS_STRING = "airflow.providers.google.cloud.hooks.gcs.{}"
diff --git a/providers/tests/google/cloud/log/test_stackdriver_task_handler.py
b/providers/tests/google/cloud/log/test_stackdriver_task_handler.py
index 8dd92a13b2a..bc3ab1ca735 100644
--- a/providers/tests/google/cloud/log/test_stackdriver_task_handler.py
+++ b/providers/tests/google/cloud/log/test_stackdriver_task_handler.py
@@ -30,9 +30,9 @@ from
airflow.providers.google.cloud.log.stackdriver_task_handler import Stackdri
from airflow.utils import timezone
from airflow.utils.state import TaskInstanceState
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_3_0_PLUS
def _create_list_log_entries_response_mock(messages, token):
diff --git a/providers/tests/google/cloud/operators/test_bigquery_dts.py
b/providers/tests/google/cloud/operators/test_bigquery_dts.py
index 0bdaeeee7ee..c9379abddb9 100644
--- a/providers/tests/google/cloud/operators/test_bigquery_dts.py
+++ b/providers/tests/google/cloud/operators/test_bigquery_dts.py
@@ -28,7 +28,7 @@ from airflow.providers.google.cloud.operators.bigquery_dts
import (
BigQueryDeleteDataTransferConfigOperator,
)
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
PROJECT_ID = "id"
diff --git a/providers/tests/google/cloud/operators/test_dataproc.py
b/providers/tests/google/cloud/operators/test_dataproc.py
index d05634f80ff..dfdff457fcb 100644
--- a/providers/tests/google/cloud/operators/test_dataproc.py
+++ b/providers/tests/google/cloud/operators/test_dataproc.py
@@ -27,6 +27,7 @@ from google.api_core.retry_async import AsyncRetry
from google.cloud import dataproc
from google.cloud.dataproc_v1 import Batch, Cluster, JobStatus
+from airflow import __version__ as AIRFLOW_VERSION
from airflow.exceptions import (
AirflowException,
AirflowProviderDeprecationWarning,
@@ -73,8 +74,8 @@ from airflow.providers.google.common.consts import
GOOGLE_DEFAULT_DEFERRABLE_MET
from airflow.serialization.serialized_objects import SerializedDAG
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, AIRFLOW_VERSION
from tests_common.test_utils.db import clear_db_runs, clear_db_xcom
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
AIRFLOW_VERSION_LABEL = "v" + str(AIRFLOW_VERSION).replace(".",
"-").replace("+", "-")
diff --git a/providers/tests/google/common/auth_backend/test_google_openid.py
b/providers/tests/google/common/auth_backend/test_google_openid.py
index 5ddc9780699..7ddb8f210d6 100644
--- a/providers/tests/google/common/auth_backend/test_google_openid.py
+++ b/providers/tests/google/common/auth_backend/test_google_openid.py
@@ -23,10 +23,10 @@ from google.auth.exceptions import GoogleAuthError
from airflow.www.app import create_app
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_pools
from tests_common.test_utils.decorators import
dont_initialize_flask_app_submodules
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
@pytest.fixture(scope="module")
diff --git a/providers/tests/microsoft/azure/operators/test_data_factory.py
b/providers/tests/microsoft/azure/operators/test_data_factory.py
index 429aa518e9b..9eb8a682656 100644
--- a/providers/tests/microsoft/azure/operators/test_data_factory.py
+++ b/providers/tests/microsoft/azure/operators/test_data_factory.py
@@ -38,7 +38,7 @@ from airflow.providers.microsoft.azure.triggers.data_factory
import AzureDataFac
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if TYPE_CHECKING:
from airflow.models.baseoperator import BaseOperator
diff --git a/providers/tests/microsoft/azure/operators/test_msgraph.py
b/providers/tests/microsoft/azure/operators/test_msgraph.py
index 2c9c8129d5d..b722c4c9f0e 100644
--- a/providers/tests/microsoft/azure/operators/test_msgraph.py
+++ b/providers/tests/microsoft/azure/operators/test_msgraph.py
@@ -35,7 +35,7 @@ from providers.tests.microsoft.conftest import (
mock_json_response,
mock_response,
)
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
if TYPE_CHECKING:
from airflow.utils.context import Context
diff --git a/providers/tests/microsoft/azure/sensors/test_msgraph.py
b/providers/tests/microsoft/azure/sensors/test_msgraph.py
index 8b8ec793d65..9ad03ccf170 100644
--- a/providers/tests/microsoft/azure/sensors/test_msgraph.py
+++ b/providers/tests/microsoft/azure/sensors/test_msgraph.py
@@ -25,7 +25,7 @@ from airflow.triggers.base import TriggerEvent
from providers.tests.microsoft.azure.base import Base
from providers.tests.microsoft.conftest import load_json, mock_json_response
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
class TestMSGraphSensor(Base):
diff --git a/providers/tests/openlineage/extractors/test_manager.py
b/providers/tests/openlineage/extractors/test_manager.py
index adba74fd440..6b5e0dedd96 100644
--- a/providers/tests/openlineage/extractors/test_manager.py
+++ b/providers/tests/openlineage/extractors/test_manager.py
@@ -38,7 +38,8 @@ from airflow.providers.openlineage.extractors.manager import
ExtractorManager
from airflow.providers.openlineage.utils.utils import Asset
from airflow.utils.state import State
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS, PythonOperator
+from tests_common.test_utils.compat import PythonOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
if TYPE_CHECKING:
from airflow.utils.context import Context
diff --git a/providers/tests/openlineage/plugins/test_adapter.py
b/providers/tests/openlineage/plugins/test_adapter.py
index a2266bb16bc..a7f80085323 100644
--- a/providers/tests/openlineage/plugins/test_adapter.py
+++ b/providers/tests/openlineage/plugins/test_adapter.py
@@ -52,8 +52,9 @@ from airflow.providers.openlineage.plugins.facets import (
from airflow.providers.openlineage.utils.utils import get_airflow_job_facet
from airflow.utils.task_group import TaskGroup
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BashOperator
+from tests_common.test_utils.compat import BashOperator
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/openlineage/plugins/test_execution.py
b/providers/tests/openlineage/plugins/test_execution.py
index b3659feed93..039064e7053 100644
--- a/providers/tests/openlineage/plugins/test_execution.py
+++ b/providers/tests/openlineage/plugins/test_execution.py
@@ -35,8 +35,8 @@ from airflow.providers.openlineage.plugins.listener import
OpenLineageListener
from airflow.utils import timezone
from airflow.utils.state import State
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS,
AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS,
AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/openlineage/plugins/test_listener.py
b/providers/tests/openlineage/plugins/test_listener.py
index ccb330faa5d..eeca49c7f8d 100644
--- a/providers/tests/openlineage/plugins/test_listener.py
+++ b/providers/tests/openlineage/plugins/test_listener.py
@@ -38,8 +38,9 @@ from airflow.providers.openlineage.plugins.listener import
OpenLineageListener
from airflow.providers.openlineage.utils.selective_enable import
disable_lineage, enable_lineage
from airflow.utils.state import DagRunState, State
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS,
AIRFLOW_V_3_0_PLUS, PythonOperator
+from tests_common.test_utils.compat import PythonOperator
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS,
AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/openlineage/plugins/test_utils.py
b/providers/tests/openlineage/plugins/test_utils.py
index 046f836bb36..475624fef8f 100644
--- a/providers/tests/openlineage/plugins/test_utils.py
+++ b/providers/tests/openlineage/plugins/test_utils.py
@@ -49,11 +49,9 @@ from airflow.utils.log.secrets_masker import _secrets_masker
from airflow.utils.state import State
from tests_common.test_utils.compat import (
- AIRFLOW_V_2_9_PLUS,
- AIRFLOW_V_2_10_PLUS,
- AIRFLOW_V_3_0_PLUS,
BashOperator,
)
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_2_10_PLUS, AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/opensearch/log/test_os_task_handler.py
b/providers/tests/opensearch/log/test_os_task_handler.py
index 97e3054ddef..4d7c9eb53a7 100644
--- a/providers/tests/opensearch/log/test_os_task_handler.py
+++ b/providers/tests/opensearch/log/test_os_task_handler.py
@@ -45,9 +45,9 @@ from airflow.utils.state import DagRunState, TaskInstanceState
from airflow.utils.timezone import datetime
from providers.tests.opensearch.conftest import MockClient
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/presto/hooks/test_presto.py
b/providers/tests/presto/hooks/test_presto.py
index bd4e2e589f0..c27d27a68cb 100644
--- a/providers/tests/presto/hooks/test_presto.py
+++ b/providers/tests/presto/hooks/test_presto.py
@@ -29,7 +29,7 @@ from airflow.exceptions import AirflowException
from airflow.models import Connection
from airflow.providers.presto.hooks.presto import PrestoHook,
generate_presto_client_info
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
def test_generate_airflow_presto_client_info_header():
diff --git a/providers/tests/redis/log/test_redis_task_handler.py
b/providers/tests/redis/log/test_redis_task_handler.py
index 0f86ff65bf4..604dcb1c731 100644
--- a/providers/tests/redis/log/test_redis_task_handler.py
+++ b/providers/tests/redis/log/test_redis_task_handler.py
@@ -29,8 +29,8 @@ from airflow.utils.session import create_session
from airflow.utils.state import State
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/sftp/operators/test_sftp.py
b/providers/tests/sftp/operators/test_sftp.py
index 86965e0ed19..8feca53a07b 100644
--- a/providers/tests/sftp/operators/test_sftp.py
+++ b/providers/tests/sftp/operators/test_sftp.py
@@ -36,8 +36,8 @@ from airflow.providers.ssh.operators.ssh import SSHOperator
from airflow.utils import timezone
from airflow.utils.timezone import datetime
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/smtp/notifications/test_smtp.py
b/providers/tests/smtp/notifications/test_smtp.py
index 4c559df628e..8ce28637d8f 100644
--- a/providers/tests/smtp/notifications/test_smtp.py
+++ b/providers/tests/smtp/notifications/test_smtp.py
@@ -31,8 +31,8 @@ from airflow.providers.smtp.notifications.smtp import (
)
from airflow.utils import timezone
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
pytestmark = pytest.mark.db_test
diff --git a/providers/tests/snowflake/operators/test_snowflake.py
b/providers/tests/snowflake/operators/test_snowflake.py
index e461a0b6f62..43795f22ace 100644
--- a/providers/tests/snowflake/operators/test_snowflake.py
+++ b/providers/tests/snowflake/operators/test_snowflake.py
@@ -37,7 +37,7 @@ from airflow.providers.snowflake.triggers.snowflake_trigger
import SnowflakeSqlA
from airflow.utils import timezone
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
DEFAULT_DATE = timezone.datetime(2015, 1, 1)
DEFAULT_DATE_ISO = DEFAULT_DATE.isoformat()
diff --git a/providers/tests/standard/operators/test_bash.py
b/providers/tests/standard/operators/test_bash.py
index 9b299c2423f..81c64048cba 100644
--- a/providers/tests/standard/operators/test_bash.py
+++ b/providers/tests/standard/operators/test_bash.py
@@ -34,7 +34,7 @@ from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if TYPE_CHECKING:
from airflow.models import TaskInstance
diff --git a/providers/tests/standard/operators/test_latest_only_operator.py
b/providers/tests/standard/operators/test_latest_only_operator.py
index fa20f294fd0..5884c54774c 100644
--- a/providers/tests/standard/operators/test_latest_only_operator.py
+++ b/providers/tests/standard/operators/test_latest_only_operator.py
@@ -31,8 +31,8 @@ from airflow.utils.state import State
from airflow.utils.trigger_rule import TriggerRule
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs, clear_db_xcom
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/providers/tests/standard/operators/test_python.py
b/providers/tests/standard/operators/test_python.py
index 828b4c2bc27..a434448ff33 100644
--- a/providers/tests/standard/operators/test_python.py
+++ b/providers/tests/standard/operators/test_python.py
@@ -71,8 +71,8 @@ from airflow.utils.trigger_rule import TriggerRule
from airflow.utils.types import NOTSET, DagRunType
from tests_common.test_utils import AIRFLOW_MAIN_FOLDER
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_2_10_PLUS, AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_2_10_PLUS, AIRFLOW_V_3_0_PLUS
if TYPE_CHECKING:
from airflow.models.dagrun import DagRun
diff --git a/providers/tests/standard/triggers/test_external_task.py
b/providers/tests/standard/triggers/test_external_task.py
index 53db233a0ae..63f1748880c 100644
--- a/providers/tests/standard/triggers/test_external_task.py
+++ b/providers/tests/standard/triggers/test_external_task.py
@@ -29,7 +29,7 @@ from airflow.triggers.base import TriggerEvent
from airflow.utils import timezone
from airflow.utils.state import DagRunState
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS,
AIRFLOW_V_3_0_PLUS
_DATES = (
{"logical_dates": [timezone.datetime(2022, 1, 1)]}
diff --git a/providers/tests/standard/utils/test_python_virtualenv.py
b/providers/tests/standard/utils/test_python_virtualenv.py
index 7928ddfa10c..c328a0bb400 100644
--- a/providers/tests/standard/utils/test_python_virtualenv.py
+++ b/providers/tests/standard/utils/test_python_virtualenv.py
@@ -25,8 +25,8 @@ import pytest
from airflow.providers.standard.utils.python_virtualenv import
_generate_pip_conf, _use_uv, prepare_virtualenv
from airflow.utils.decorators import remove_task_decorator
-from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
class TestPrepareVirtualenv:
diff --git a/providers/tests/trino/hooks/test_trino.py
b/providers/tests/trino/hooks/test_trino.py
index 1cebc4eaaa4..a9a4137da8d 100644
--- a/providers/tests/trino/hooks/test_trino.py
+++ b/providers/tests/trino/hooks/test_trino.py
@@ -29,7 +29,7 @@ from airflow.exceptions import AirflowException
from airflow.models import Connection
from airflow.providers.trino.hooks.trino import TrinoHook
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
HOOK_GET_CONNECTION =
"airflow.providers.trino.hooks.trino.TrinoHook.get_connection"
BASIC_AUTHENTICATION =
"airflow.providers.trino.hooks.trino.trino.auth.BasicAuthentication"
diff --git a/providers/tests/yandex/links/test_yq.py
b/providers/tests/yandex/links/test_yq.py
index e1033366ae0..444ae762ac2 100644
--- a/providers/tests/yandex/links/test_yq.py
+++ b/providers/tests/yandex/links/test_yq.py
@@ -24,8 +24,8 @@ from airflow.models.taskinstance import TaskInstance
from airflow.models.xcom import XCom
from airflow.providers.yandex.links.yq import YQLink
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.mock_operators import MockOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
yandexcloud = pytest.importorskip("yandexcloud")
diff --git a/providers/tests/yandex/operators/test_yq.py
b/providers/tests/yandex/operators/test_yq.py
index 32a454c7e90..3c415f6ac6b 100644
--- a/providers/tests/yandex/operators/test_yq.py
+++ b/providers/tests/yandex/operators/test_yq.py
@@ -22,7 +22,7 @@ from unittest.mock import MagicMock, call, patch
import pytest
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
yandexcloud = pytest.importorskip("yandexcloud")
diff --git a/tests/api_connexion/endpoints/test_dag_run_endpoint.py
b/tests/api_connexion/endpoints/test_dag_run_endpoint.py
index 45e6bf53376..4f322bb8f0a 100644
--- a/tests/api_connexion/endpoints/test_dag_run_endpoint.py
+++ b/tests/api_connexion/endpoints/test_dag_run_endpoint.py
@@ -36,9 +36,9 @@ from airflow.utils.state import DagRunState, State
from airflow.utils.types import DagRunType
from tests_common.test_utils.api_connexion_utils import assert_401,
create_user, delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_serialized_dags
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import _check_last_log
if AIRFLOW_V_3_0_PLUS:
diff --git a/tests/api_connexion/endpoints/test_extra_link_endpoint.py
b/tests/api_connexion/endpoints/test_extra_link_endpoint.py
index 9fe083d824e..8cb8dd4e030 100644
--- a/tests/api_connexion/endpoints/test_extra_link_endpoint.py
+++ b/tests/api_connexion/endpoints/test_extra_link_endpoint.py
@@ -32,10 +32,11 @@ from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunType
from tests_common.test_utils.api_connexion_utils import create_user,
delete_user
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink
+from tests_common.test_utils.compat import BaseOperatorLink
from tests_common.test_utils.db import clear_db_runs, clear_db_xcom
from tests_common.test_utils.mock_operators import CustomOperator
from tests_common.test_utils.mock_plugins import mock_plugin_manager
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/api_connexion/schemas/test_dag_run_schema.py
b/tests/api_connexion/schemas/test_dag_run_schema.py
index ce7bea98037..61b3dac6350 100644
--- a/tests/api_connexion/schemas/test_dag_run_schema.py
+++ b/tests/api_connexion/schemas/test_dag_run_schema.py
@@ -30,8 +30,8 @@ from airflow.utils import timezone
from airflow.utils.session import provide_session
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/api_fastapi/core_api/routes/public/test_extra_links.py
b/tests/api_fastapi/core_api/routes/public/test_extra_links.py
index 4c9f3bf7d48..6a2ca465007 100644
--- a/tests/api_fastapi/core_api/routes/public/test_extra_links.py
+++ b/tests/api_fastapi/core_api/routes/public/test_extra_links.py
@@ -30,10 +30,11 @@ from airflow.utils.session import provide_session
from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink
+from tests_common.test_utils.compat import BaseOperatorLink
from tests_common.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_xcom
from tests_common.test_utils.mock_operators import CustomOperator
from tests_common.test_utils.mock_plugins import mock_plugin_manager
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/cli/commands/remote_commands/test_task_command.py
b/tests/cli/commands/remote_commands/test_task_command.py
index e09640bca39..66177c2d84e 100644
--- a/tests/cli/commands/remote_commands/test_task_command.py
+++ b/tests/cli/commands/remote_commands/test_task_command.py
@@ -52,9 +52,9 @@ from airflow.utils.session import create_session
from airflow.utils.state import State, TaskInstanceState
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_pools, clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/dag_processing/test_processor.py
b/tests/dag_processing/test_processor.py
index 808b7af007e..336e2ab242c 100644
--- a/tests/dag_processing/test_processor.py
+++ b/tests/dag_processing/test_processor.py
@@ -41,7 +41,7 @@ from airflow.utils.state import State
from airflow.utils.types import DagRunType
from tests_common.test_utils.asserts import assert_queries_count
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, ParseImportError
+from tests_common.test_utils.compat import ParseImportError
from tests_common.test_utils.config import conf_vars, env_vars
from tests_common.test_utils.db import (
clear_db_dags,
@@ -52,6 +52,7 @@ from tests_common.test_utils.db import (
clear_db_serialized_dags,
)
from tests_common.test_utils.mock_executor import MockExecutor
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/decorators/test_python.py b/tests/decorators/test_python.py
index b53a379e861..6b511b6b715 100644
--- a/tests/decorators/test_python.py
+++ b/tests/decorators/test_python.py
@@ -42,7 +42,7 @@ from airflow.utils.types import DagRunType
from airflow.utils.xcom import XCOM_RETURN_KEY
from providers.tests.standard.operators.test_python import BasePythonTest
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/jobs/test_local_task_job.py
b/tests/jobs/test_local_task_job.py
index 255779e3708..3ca565cf5e2 100644
--- a/tests/jobs/test_local_task_job.py
+++ b/tests/jobs/test_local_task_job.py
@@ -53,9 +53,9 @@ from airflow.utils.types import DagRunType
from tests_common.test_utils import db
from tests_common.test_utils.asserts import assert_queries_count
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.mock_executor import MockExecutor
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/jobs/test_scheduler_job.py b/tests/jobs/test_scheduler_job.py
index 6b413135bfc..7bba60dabbd 100644
--- a/tests/jobs/test_scheduler_job.py
+++ b/tests/jobs/test_scheduler_job.py
@@ -79,7 +79,6 @@ from tests.listeners.test_listeners import
get_listener_manager
from tests.models import TEST_DAGS_FOLDER
from tests.utils.test_timezone import UTC
from tests_common.test_utils.asserts import assert_queries_count
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars, env_vars
from tests_common.test_utils.db import (
clear_db_assets,
@@ -94,6 +93,7 @@ from tests_common.test_utils.db import (
)
from tests_common.test_utils.mock_executor import MockExecutor
from tests_common.test_utils.mock_operators import CustomOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/listeners/class_listener.py
b/tests/listeners/class_listener.py
index 7dcda72c5e2..90ff6ab975e 100644
--- a/tests/listeners/class_listener.py
+++ b/tests/listeners/class_listener.py
@@ -20,7 +20,7 @@ from __future__ import annotations
from airflow.listeners import hookimpl
from airflow.utils.state import DagRunState, TaskInstanceState
-from tests_common.test_utils.compat import AIRFLOW_V_2_10_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
if AIRFLOW_V_2_10_PLUS:
diff --git a/tests/models/test_cleartasks.py b/tests/models/test_cleartasks.py
index 9848ca17ea5..9b5af0b62c5 100644
--- a/tests/models/test_cleartasks.py
+++ b/tests/models/test_cleartasks.py
@@ -37,7 +37,7 @@ from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
from tests_common.test_utils import db
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/models/test_dag.py b/tests/models/test_dag.py
index 15b5cdf6960..534cfa67566 100644
--- a/tests/models/test_dag.py
+++ b/tests/models/test_dag.py
@@ -96,7 +96,6 @@ from tests.plugins.priority_weight_strategy import (
TestPriorityWeightStrategyPlugin,
)
from tests_common.test_utils.asserts import assert_queries_count
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import (
clear_db_assets,
@@ -107,6 +106,7 @@ from tests_common.test_utils.db import (
from tests_common.test_utils.mapping import expand_mapped_task
from tests_common.test_utils.mock_plugins import mock_plugin_manager
from tests_common.test_utils.timetables import cron_timetable, delta_timetable
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/models/test_dagrun.py b/tests/models/test_dagrun.py
index b9ef0b88600..53cf0b0f672 100644
--- a/tests/models/test_dagrun.py
+++ b/tests/models/test_dagrun.py
@@ -50,9 +50,9 @@ from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE as _DEFAULT_DATE
from tests_common.test_utils import db
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.mock_operators import MockOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/models/test_taskinstance.py
b/tests/models/test_taskinstance.py
index 51803e788cb..cd78882ebf1 100644
--- a/tests/models/test_taskinstance.py
+++ b/tests/models/test_taskinstance.py
@@ -98,10 +98,10 @@ from airflow.utils.xcom import XCOM_RETURN_KEY
from tests.models import DEFAULT_DATE, TEST_DAGS_FOLDER
from tests_common.test_utils import db
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_connections, clear_db_runs
from tests_common.test_utils.mock_operators import MockOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/operators/test_branch_operator.py
b/tests/operators/test_branch_operator.py
index eb014222a98..2c9191c2b4b 100644
--- a/tests/operators/test_branch_operator.py
+++ b/tests/operators/test_branch_operator.py
@@ -29,7 +29,7 @@ from airflow.utils.state import State
from airflow.utils.task_group import TaskGroup
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/sensors/test_external_task_sensor.py
b/tests/sensors/test_external_task_sensor.py
index 28ccfe42845..ba3cfd6b448 100644
--- a/tests/sensors/test_external_task_sensor.py
+++ b/tests/sensors/test_external_task_sensor.py
@@ -53,9 +53,9 @@ from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
from tests.models import TEST_DAGS_FOLDER
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
from tests_common.test_utils.mock_operators import MockOperator
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/task/test_standard_task_runner.py
b/tests/task/test_standard_task_runner.py
index e573a4961f5..5e9eee15b07 100644
--- a/tests/task/test_standard_task_runner.py
+++ b/tests/task/test_standard_task_runner.py
@@ -43,8 +43,8 @@ from airflow.utils.timeout import timeout
from tests.listeners import xcom_listener
from tests.listeners.file_write_listener import FileWriteListener
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/ti_deps/deps/test_prev_dagrun_dep.py
b/tests/ti_deps/deps/test_prev_dagrun_dep.py
index 3f2a2f7d47e..c0607f93222 100644
--- a/tests/ti_deps/deps/test_prev_dagrun_dep.py
+++ b/tests/ti_deps/deps/test_prev_dagrun_dep.py
@@ -30,8 +30,8 @@ from airflow.utils.state import DagRunState, TaskInstanceState
from airflow.utils.timezone import convert_to_utc, datetime
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/utils/test_log_handlers.py b/tests/utils/test_log_handlers.py
index 3fa753283f4..19a432bb737 100644
--- a/tests/utils/test_log_handlers.py
+++ b/tests/utils/test_log_handlers.py
@@ -55,8 +55,8 @@ from airflow.utils.state import State, TaskInstanceState
from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/utils/test_sqlalchemy.py b/tests/utils/test_sqlalchemy.py
index 5a005ece092..0e791de1955 100644
--- a/tests/utils/test_sqlalchemy.py
+++ b/tests/utils/test_sqlalchemy.py
@@ -43,7 +43,7 @@ from airflow.utils.sqlalchemy import (
from airflow.utils.state import State
from airflow.utils.timezone import utcnow
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/utils/test_state.py b/tests/utils/test_state.py
index 676fc03eb16..5ad9f4a7044 100644
--- a/tests/utils/test_state.py
+++ b/tests/utils/test_state.py
@@ -27,7 +27,7 @@ from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/utils/test_task_handler_with_custom_formatter.py
b/tests/utils/test_task_handler_with_custom_formatter.py
index 7de26a52463..8d2856927af 100644
--- a/tests/utils/test_task_handler_with_custom_formatter.py
+++ b/tests/utils/test_task_handler_with_custom_formatter.py
@@ -29,9 +29,9 @@ from airflow.utils.state import DagRunState
from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_runs
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/utils/test_types.py b/tests/utils/test_types.py
index ed68a3b9352..c66c5807988 100644
--- a/tests/utils/test_types.py
+++ b/tests/utils/test_types.py
@@ -27,7 +27,7 @@ from airflow.utils.state import State
from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/www/test_utils.py b/tests/www/test_utils.py
index eba5b37758d..c87848fdf0e 100644
--- a/tests/www/test_utils.py
+++ b/tests/www/test_utils.py
@@ -45,7 +45,7 @@ from airflow.www.utils import (
)
from airflow.www.widgets import AirflowDateTimePickerROWidget,
BS3TextAreaROWidget, BS3TextFieldROWidget
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/www/views/test_views.py b/tests/www/views/test_views.py
index 338337d258b..c138e24125a 100644
--- a/tests/www/views/test_views.py
+++ b/tests/www/views/test_views.py
@@ -41,9 +41,9 @@ from airflow.www.views import (
get_value_from_path,
)
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.mock_plugins import mock_plugin_manager
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import check_content_in_response,
check_content_not_in_response
if AIRFLOW_V_3_0_PLUS:
diff --git a/tests/www/views/test_views_acl.py
b/tests/www/views/test_views_acl.py
index 331a0e565a1..0f430b9b6dc 100644
--- a/tests/www/views/test_views_acl.py
+++ b/tests/www/views/test_views_acl.py
@@ -32,9 +32,9 @@ from airflow.utils.types import DagRunType
from airflow.www.views import FILTER_STATUS_COOKIE
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import
create_user_scope
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs
from tests_common.test_utils.permissions import _resource_name
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import (
check_content_in_response,
check_content_not_in_response,
diff --git a/tests/www/views/test_views_dagrun.py
b/tests/www/views/test_views_dagrun.py
index 7b9e7b9ac3a..c7f860d6246 100644
--- a/tests/www/views/test_views_dagrun.py
+++ b/tests/www/views/test_views_dagrun.py
@@ -31,7 +31,7 @@ from
providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import (
delete_user,
)
from tests.www.views.test_views_tasks import _get_appbuilder_pk_string
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import (
check_content_in_response,
check_content_not_in_response,
diff --git a/tests/www/views/test_views_decorators.py
b/tests/www/views/test_views_decorators.py
index c6c849606ef..5815510b07f 100644
--- a/tests/www/views/test_views_decorators.py
+++ b/tests/www/views/test_views_decorators.py
@@ -24,8 +24,8 @@ from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.db import clear_db_runs, clear_db_variables
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import (
_check_last_log,
_check_last_log_masked_variable,
diff --git a/tests/www/views/test_views_extra_links.py
b/tests/www/views/test_views_extra_links.py
index 26d378750ba..6ea977da7fa 100644
--- a/tests/www/views/test_views_extra_links.py
+++ b/tests/www/views/test_views_extra_links.py
@@ -29,13 +29,14 @@ from airflow.utils import timezone
from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink
+from tests_common.test_utils.compat import BaseOperatorLink
from tests_common.test_utils.db import clear_db_runs
from tests_common.test_utils.mock_operators import (
AirflowLink,
EmptyExtraLinkTestOperator,
EmptyNoExtraLinkTestOperator,
)
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
if AIRFLOW_V_3_0_PLUS:
from airflow.utils.types import DagRunTriggeredByType
diff --git a/tests/www/views/test_views_log.py
b/tests/www/views/test_views_log.py
index 15cee40796b..be492487a4c 100644
--- a/tests/www/views/test_views_log.py
+++ b/tests/www/views/test_views_log.py
@@ -41,10 +41,10 @@ from airflow.utils.state import DagRunState,
TaskInstanceState
from airflow.utils.types import DagRunType
from airflow.www.app import create_app
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
from tests_common.test_utils.decorators import
dont_initialize_flask_app_submodules
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import client_with_login
if AIRFLOW_V_3_0_PLUS:
diff --git a/tests/www/views/test_views_rendered.py
b/tests/www/views/test_views_rendered.py
index 5b10d12f17c..0af32512c4d 100644
--- a/tests/www/views/test_views_rendered.py
+++ b/tests/www/views/test_views_rendered.py
@@ -34,13 +34,14 @@ from airflow.utils.session import create_session
from airflow.utils.state import DagRunState, TaskInstanceState
from airflow.utils.types import DagRunType
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BashOperator,
PythonOperator
+from tests_common.test_utils.compat import BashOperator, PythonOperator
from tests_common.test_utils.db import (
clear_db_dags,
clear_db_runs,
clear_rendered_ti_fields,
initial_db_init,
)
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import check_content_in_response,
check_content_not_in_response
if AIRFLOW_V_3_0_PLUS:
diff --git a/tests/www/views/test_views_tasks.py
b/tests/www/views/test_views_tasks.py
index 2f902395e6c..11c155d3d60 100644
--- a/tests/www/views/test_views_tasks.py
+++ b/tests/www/views/test_views_tasks.py
@@ -49,9 +49,10 @@ from
providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import (
delete_roles,
delete_user,
)
-from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BashOperator
+from tests_common.test_utils.compat import BashOperator
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_runs, clear_db_xcom
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
from tests_common.test_utils.www import (
check_content_in_response,
check_content_not_in_response,
diff --git a/tests_common/pytest_plugin.py b/tests_common/pytest_plugin.py
index b0b76e8cf9c..42e4a1f722a 100644
--- a/tests_common/pytest_plugin.py
+++ b/tests_common/pytest_plugin.py
@@ -773,7 +773,7 @@ def dag_maker(request) -> Generator[DagMaker, None, None]:
from airflow.utils.log.logging_mixin import LoggingMixin
- from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
class DagFactory(LoggingMixin, DagMaker):
_own_session = False
@@ -1102,7 +1102,7 @@ def create_dummy_dag(dag_maker: DagMaker) ->
CreateDummyDAG:
**kwargs,
):
op_kwargs = {}
- from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
if AIRFLOW_V_2_9_PLUS:
op_kwargs["task_display_name"] = task_display_name
@@ -1168,7 +1168,7 @@ def create_task_instance(dag_maker: DagMaker,
create_dummy_dag: CreateDummyDAG)
"""
from airflow.operators.empty import EmptyOperator
- from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
def maker(
logical_date=None,
@@ -1384,7 +1384,7 @@ def reset_logging_config():
def suppress_info_logs_for_dag_and_fab():
import logging
- from tests_common.test_utils.compat import AIRFLOW_V_2_9_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_2_9_PLUS
dag_logger = logging.getLogger("airflow.models.dag")
dag_logger.setLevel(logging.WARNING)
diff --git a/tests_common/test_utils/compat.py
b/tests_common/test_utils/compat.py
index 5ec9c4edab4..3bd4b89dfc1 100644
--- a/tests_common/test_utils/compat.py
+++ b/tests_common/test_utils/compat.py
@@ -18,15 +18,14 @@ from __future__ import annotations
import contextlib
import json
-import os
from typing import TYPE_CHECKING, Any, cast
-from packaging.version import Version
-
from airflow.exceptions import AirflowOptionalProviderFeatureException
from airflow.models import Connection, Operator
from airflow.utils.helpers import prune_dict
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS
+
try:
# ImportError has been renamed to ParseImportError in airflow 2.10.0, and
since our provider tests should
# run on all supported versions of Airflow, this compatibility shim falls
back to the old ImportError so
@@ -37,13 +36,6 @@ try:
except ImportError:
from airflow.models.errors import ImportError as ParseImportError # type:
ignore[no-redef,attr-defined]
-from airflow import __version__ as airflow_version
-
-AIRFLOW_VERSION = Version(airflow_version)
-AIRFLOW_V_2_9_PLUS = Version(AIRFLOW_VERSION.base_version) >= Version("2.9.0")
-AIRFLOW_V_2_10_PLUS = Version(AIRFLOW_VERSION.base_version) >=
Version("2.10.0")
-AIRFLOW_V_3_0_PLUS = Version(AIRFLOW_VERSION.base_version) >= Version("3.0.0")
-
try:
from airflow.models.baseoperatorlink import BaseOperatorLink
except ImportError:
diff --git a/tests_common/test_utils/db.py b/tests_common/test_utils/db.py
index 4f18524c726..61c9c1394a5 100644
--- a/tests_common/test_utils/db.py
+++ b/tests_common/test_utils/db.py
@@ -42,8 +42,6 @@ from airflow.utils.db import add_default_pool_if_not_exists,
create_default_conn
from airflow.utils.session import create_session
from tests_common.test_utils.compat import (
- AIRFLOW_V_2_10_PLUS,
- AIRFLOW_V_3_0_PLUS,
AssetDagRunQueue,
AssetEvent,
AssetModel,
@@ -51,6 +49,7 @@ from tests_common.test_utils.compat import (
ParseImportError,
TaskOutletAssetReference,
)
+from tests_common.test_utils.version_compat import AIRFLOW_V_2_10_PLUS,
AIRFLOW_V_3_0_PLUS
def _bootstrap_dagbag():
@@ -74,7 +73,7 @@ def initial_db_init():
from airflow.www.extensions.init_appbuilder import init_appbuilder
from airflow.www.extensions.init_auth_manager import get_auth_manager
- from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS
+ from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
db.resetdb()
if AIRFLOW_V_3_0_PLUS:
diff --git a/tests_common/test_utils/version_compat.py
b/tests_common/test_utils/version_compat.py
new file mode 100644
index 00000000000..fd48d6863d3
--- /dev/null
+++ b/tests_common/test_utils/version_compat.py
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+
+def get_base_airflow_version_tuple() -> tuple[int, int, int]:
+ from packaging.version import Version
+
+ from airflow import __version__
+
+ airflow_version = Version(__version__)
+ return airflow_version.major, airflow_version.minor, airflow_version.micro
+
+
+AIRFLOW_V_2_9_PLUS = get_base_airflow_version_tuple() >= (2, 9, 0)
+AIRFLOW_V_2_10_PLUS = get_base_airflow_version_tuple() >= (2, 10, 0)
+AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)