This is an automated email from the ASF dual-hosted git repository.
Lee-W 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 4a73814adb0 Use common.compat.sdk for timezone imports in providers
(#70492)
4a73814adb0 is described below
commit 4a73814adb02a403eb37882d0b9b82ad3c93c53d
Author: PoAn Yang <[email protected]>
AuthorDate: Tue Jul 28 16:19:19 2026 +0900
Use common.compat.sdk for timezone imports in providers (#70492)
Signed-off-by: PoAn Yang <[email protected]>
---
.../tests/unit/alibaba/cloud/sensors/test_analyticdb_spark.py | 2 +-
.../tests/unit/apache/flink/operators/test_flink_kubernetes.py | 2 +-
.../tests/unit/apache/flink/sensors/test_flink_kubernetes.py | 3 +--
providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py | 3 +--
.../apache/hive/tests/unit/apache/hive/operators/test_hive.py | 3 +--
.../hive/tests/unit/apache/hive/transfers/test_hive_to_mysql.py | 3 +--
.../hive/tests/unit/apache/hive/transfers/test_mysql_to_hive.py | 2 +-
.../apache/livy/tests/unit/apache/livy/operators/test_livy.py | 3 +--
providers/apache/livy/tests/unit/apache/livy/sensors/test_livy.py | 2 +-
.../spark/tests/unit/apache/spark/decorators/test_pyspark.py | 2 +-
.../spark/tests/unit/apache/spark/operators/test_spark_jdbc.py | 2 +-
.../spark/tests/unit/apache/spark/operators/test_spark_pyspark.py | 2 +-
.../spark/tests/unit/apache/spark/operators/test_spark_sql.py | 2 +-
.../spark/tests/unit/apache/spark/operators/test_spark_submit.py | 2 +-
.../tests/unit/apache/tinkerpop/operators/test_gremlin.py | 2 +-
providers/arangodb/tests/unit/arangodb/sensors/test_arangodb.py | 2 +-
.../jira/tests/unit/atlassian/jira/operators/test_jira.py | 2 +-
.../atlassian/jira/tests/unit/atlassian/jira/sensors/test_jira.py | 2 +-
.../kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py | 3 +--
.../kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py | 2 +-
.../tests/unit/cncf/kubernetes/operators/test_resource.py | 3 +--
.../tests/unit/cncf/kubernetes/operators/test_spark_kubernetes.py | 3 +--
.../tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py | 3 +--
.../common/ai/tests/unit/common/ai/plugins/test_hitl_review.py | 2 +-
.../sql/tests/system/common/sql/example_generic_transfer.py | 2 +-
.../sql/tests/system/common/sql/example_sql_column_table_check.py | 2 +-
.../sql/tests/unit/common/sql/operators/test_generic_transfer.py | 2 +-
.../dbt/cloud/tests/unit/dbt/cloud/utils/test_openlineage.py | 3 +--
providers/dingding/tests/unit/dingding/operators/test_dingding.py | 2 +-
.../discord/tests/unit/discord/operators/test_discord_webhook.py | 2 +-
.../tests/unit/elasticsearch/log/test_es_task_handler.py | 8 +++-----
providers/ftp/tests/unit/ftp/operators/test_ftp.py | 5 ++---
.../google/src/airflow/providers/google/cloud/operators/gcs.py | 3 +--
.../google/src/airflow/providers/google/cloud/triggers/gcs.py | 2 +-
.../tests/unit/google/cloud/log/test_stackdriver_task_handler.py | 2 +-
.../google/cloud/operators/test_cloud_storage_transfer_service.py | 3 +--
.../google/tests/unit/google/cloud/operators/test_compute.py | 3 +--
.../unit/google/marketing_platform/operators/test_bid_manager.py | 2 +-
.../google/marketing_platform/operators/test_campaign_manager.py | 2 +-
.../google/marketing_platform/operators/test_display_video.py | 2 +-
.../azure/src/airflow/providers/microsoft/azure/hooks/batch.py | 3 +--
.../tests/unit/microsoft/azure/operators/test_data_factory.py | 3 +--
.../azure/tests/unit/microsoft/azure/operators/test_synapse.py | 3 +--
.../azure/tests/unit/microsoft/azure/sensors/test_wasb.py | 3 +--
providers/mongo/tests/integration/mongo/sensors/test_mongo.py | 2 +-
providers/mongo/tests/unit/mongo/sensors/test_mongo.py | 2 +-
.../openlineage/tests/unit/openlineage/plugins/test_execution.py | 2 +-
.../opensearch/tests/unit/opensearch/log/test_os_task_handler.py | 8 +++-----
providers/opsgenie/tests/unit/opsgenie/operators/test_opsgenie.py | 2 +-
.../papermill/tests/unit/papermill/operators/test_papermill.py | 2 +-
.../tests/integration/qdrant/operators/test_qdrant_ingest.py | 2 +-
.../redis/tests/integration/redis/operators/test_redis_publish.py | 2 +-
providers/redis/tests/integration/redis/sensors/test_redis_key.py | 2 +-
.../redis/tests/integration/redis/sensors/test_redis_pub_sub.py | 2 +-
providers/redis/tests/unit/redis/operators/test_redis_publish.py | 2 +-
providers/redis/tests/unit/redis/sensors/test_redis_key.py | 2 +-
providers/redis/tests/unit/redis/sensors/test_redis_pub_sub.py | 2 +-
providers/sftp/tests/unit/sftp/decorators/sensors/test_sftp.py | 2 +-
providers/sftp/tests/unit/sftp/operators/test_sftp.py | 6 ++----
.../snowflake/src/airflow/providers/snowflake/hooks/snowflake.py | 2 +-
.../src/airflow/providers/snowflake/utils/openlineage.py | 2 +-
.../snowflake/tests/unit/snowflake/decorators/test_snowpark.py | 3 +--
providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py | 3 +--
.../snowflake/tests/unit/snowflake/operators/test_snowpark.py | 2 +-
.../snowflake/tests/unit/snowflake/utils/test_openlineage.py | 3 +--
.../tests/unit/standard/decorators/test_python_virtualenv.py | 2 +-
providers/standard/tests/unit/standard/operators/test_bash.py | 8 ++++++--
.../tests/unit/standard/operators/test_branch_operator.py | 2 +-
.../tests/unit/standard/operators/test_latest_only_operator.py | 2 +-
providers/standard/tests/unit/standard/operators/test_weekday.py | 3 +--
.../standard/tests/unit/standard/triggers/test_external_task.py | 2 +-
providers/standard/tests/unit/standard/triggers/test_temporal.py | 6 ++++--
providers/ydb/tests/integration/ydb/operators/test_ydb.py | 2 +-
73 files changed, 87 insertions(+), 109 deletions(-)
diff --git
a/providers/alibaba/tests/unit/alibaba/cloud/sensors/test_analyticdb_spark.py
b/providers/alibaba/tests/unit/alibaba/cloud/sensors/test_analyticdb_spark.py
index 86c67190635..193c12563e0 100644
---
a/providers/alibaba/tests/unit/alibaba/cloud/sensors/test_analyticdb_spark.py
+++
b/providers/alibaba/tests/unit/alibaba/cloud/sensors/test_analyticdb_spark.py
@@ -20,7 +20,7 @@ from __future__ import annotations
from unittest import mock
from airflow.providers.alibaba.cloud.sensors.analyticdb_spark import
AnalyticDBSparkSensor
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
ADB_SPARK_SENSOR_STRING =
"airflow.providers.alibaba.cloud.sensors.analyticdb_spark.{}"
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/apache/flink/tests/unit/apache/flink/operators/test_flink_kubernetes.py
b/providers/apache/flink/tests/unit/apache/flink/operators/test_flink_kubernetes.py
index ac4c5f04f38..294bf1a11ac 100644
---
a/providers/apache/flink/tests/unit/apache/flink/operators/test_flink_kubernetes.py
+++
b/providers/apache/flink/tests/unit/apache/flink/operators/test_flink_kubernetes.py
@@ -27,7 +27,7 @@ import pytest
from airflow import DAG
from airflow.models import Connection
from airflow.providers.apache.flink.operators.flink_kubernetes import
FlinkKubernetesOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
TEST_VALID_APPLICATION_YAML = """
apiVersion: flink.apache.org/v1beta1
diff --git
a/providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py
b/providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py
index 5599d3c63d1..2f3f9c8997c 100644
---
a/providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py
+++
b/providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py
@@ -30,8 +30,7 @@ from kubernetes.client.rest import ApiException
from airflow import DAG
from airflow.models import Connection
from airflow.providers.apache.flink.sensors.flink_kubernetes import
FlinkKubernetesSensor
-from airflow.providers.common.compat.sdk import AirflowException
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import AirflowException, timezone
TEST_NO_STATE_CLUSTER = {
"apiVersion": "flink.apache.org/v1beta1",
diff --git a/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
b/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
index 0838e1e2006..314cdc144a0 100644
--- a/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
+++ b/providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py
@@ -30,9 +30,8 @@ from hmsclient import HMSClient
from airflow.models.connection import Connection
from airflow.models.dag import DAG
from airflow.providers.apache.hive.hooks.hive import HiveCliHook,
HiveMetastoreHook, HiveServer2Hook
-from airflow.providers.common.compat.sdk import
AIRFLOW_VAR_NAME_FORMAT_MAPPING, AirflowException
+from airflow.providers.common.compat.sdk import
AIRFLOW_VAR_NAME_FORMAT_MAPPING, AirflowException, timezone
from airflow.secrets.environment_variables import CONN_ENV_PREFIX
-from airflow.utils import timezone
from tests_common.test_utils.asserts import assert_equal_ignore_multiple_spaces
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS,
AIRFLOW_V_3_3_PLUS
diff --git
a/providers/apache/hive/tests/unit/apache/hive/operators/test_hive.py
b/providers/apache/hive/tests/unit/apache/hive/operators/test_hive.py
index 5f2c908855b..70927a7f066 100644
--- a/providers/apache/hive/tests/unit/apache/hive/operators/test_hive.py
+++ b/providers/apache/hive/tests/unit/apache/hive/operators/test_hive.py
@@ -24,8 +24,7 @@ import pytest
from airflow.models import DagRun, TaskInstance
from airflow.providers.apache.hive.operators.hive import HiveOperator
-from airflow.providers.common.compat.sdk import conf
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import conf, timezone
from tests_common.test_utils.version_compat import AIRFLOW_V_3_3_PLUS
from unit.apache.hive import DEFAULT_DATE, MockSubProcess, TestHiveEnvironment
diff --git
a/providers/apache/hive/tests/unit/apache/hive/transfers/test_hive_to_mysql.py
b/providers/apache/hive/tests/unit/apache/hive/transfers/test_hive_to_mysql.py
index 1dc181c0715..2e707cbea70 100644
---
a/providers/apache/hive/tests/unit/apache/hive/transfers/test_hive_to_mysql.py
+++
b/providers/apache/hive/tests/unit/apache/hive/transfers/test_hive_to_mysql.py
@@ -24,8 +24,7 @@ from unittest.mock import MagicMock, patch
import pytest
from airflow.providers.apache.hive.transfers.hive_to_mysql import
HiveToMySqlOperator
-from airflow.providers.common.compat.sdk import context_to_airflow_vars
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import context_to_airflow_vars,
timezone
from unit.apache.hive import MockHiveServer2Hook, MockMySqlHook,
TestHiveEnvironment
diff --git
a/providers/apache/hive/tests/unit/apache/hive/transfers/test_mysql_to_hive.py
b/providers/apache/hive/tests/unit/apache/hive/transfers/test_mysql_to_hive.py
index 0d1aad8deb5..9ab1ebc31f6 100644
---
a/providers/apache/hive/tests/unit/apache/hive/transfers/test_mysql_to_hive.py
+++
b/providers/apache/hive/tests/unit/apache/hive/transfers/test_mysql_to_hive.py
@@ -25,7 +25,7 @@ from unittest import mock
import pytest
from airflow.providers.apache.hive.hooks.hive import HiveCliHook
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
try:
from airflow.providers.apache.hive.transfers.mysql_to_hive import
MySqlToHiveOperator
diff --git
a/providers/apache/livy/tests/unit/apache/livy/operators/test_livy.py
b/providers/apache/livy/tests/unit/apache/livy/operators/test_livy.py
index 3851ad9ebb7..b89c8ddb5f0 100644
--- a/providers/apache/livy/tests/unit/apache/livy/operators/test_livy.py
+++ b/providers/apache/livy/tests/unit/apache/livy/operators/test_livy.py
@@ -25,8 +25,7 @@ from airflow.models import Connection
from airflow.models.dag import DAG
from airflow.providers.apache.livy.hooks.livy import BatchState
from airflow.providers.apache.livy.operators.livy import LivyOperator
-from airflow.providers.common.compat.sdk import AirflowException
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import AirflowException, timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
BATCH_ID = 100
diff --git a/providers/apache/livy/tests/unit/apache/livy/sensors/test_livy.py
b/providers/apache/livy/tests/unit/apache/livy/sensors/test_livy.py
index 2bc44b35750..48734c1edd1 100644
--- a/providers/apache/livy/tests/unit/apache/livy/sensors/test_livy.py
+++ b/providers/apache/livy/tests/unit/apache/livy/sensors/test_livy.py
@@ -24,7 +24,7 @@ from airflow.models import Connection
from airflow.models.dag import DAG
from airflow.providers.apache.livy.hooks.livy import BatchState, LivyHook
from airflow.providers.apache.livy.sensors.livy import LivySensor
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/apache/spark/tests/unit/apache/spark/decorators/test_pyspark.py
b/providers/apache/spark/tests/unit/apache/spark/decorators/test_pyspark.py
index c662fde33f8..f4bd4fd33f7 100644
--- a/providers/apache/spark/tests/unit/apache/spark/decorators/test_pyspark.py
+++ b/providers/apache/spark/tests/unit/apache/spark/decorators/test_pyspark.py
@@ -28,7 +28,7 @@ if AIRFLOW_V_3_0_PLUS:
else:
from airflow.decorators import task # type: ignore[attr-defined,no-redef]
from airflow.models import Connection
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2021, 9, 1)
diff --git
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_jdbc.py
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_jdbc.py
index 31e8bf20fdc..da6e40095af 100644
---
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_jdbc.py
+++
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_jdbc.py
@@ -21,7 +21,7 @@ import pytest
from airflow.models.dag import DAG
from airflow.providers.apache.spark.operators.spark_jdbc import
SparkJDBCOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_pyspark.py
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_pyspark.py
index ef7b9617544..0d07430a48c 100644
---
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_pyspark.py
+++
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_pyspark.py
@@ -19,7 +19,7 @@ from __future__ import annotations
from airflow.models.dag import DAG
from airflow.providers.apache.spark.operators.spark_pyspark import
PySparkOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2024, 2, 1, tzinfo=timezone.utc)
diff --git
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_sql.py
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_sql.py
index b68e868a32e..f373423f41f 100644
--- a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_sql.py
+++ b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_sql.py
@@ -21,7 +21,7 @@ import pytest
from airflow.models.dag import DAG
from airflow.providers.apache.spark.operators.spark_sql import SparkSqlOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2024, 2, 1, tzinfo=timezone.utc)
diff --git
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_submit.py
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_submit.py
index daa0fa119ca..18a3928e791 100644
---
a/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_submit.py
+++
b/providers/apache/spark/tests/unit/apache/spark/operators/test_spark_submit.py
@@ -29,7 +29,7 @@ from airflow.exceptions import
AirflowProviderDeprecationWarning
from airflow.models import DagRun, TaskInstance
from airflow.models.dag import DAG
from airflow.providers.apache.spark.operators.spark_submit import
SparkSubmitOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
from airflow.utils.types import DagRunType
from tests_common.test_utils.dag import sync_dag_to_db
diff --git
a/providers/apache/tinkerpop/tests/unit/apache/tinkerpop/operators/test_gremlin.py
b/providers/apache/tinkerpop/tests/unit/apache/tinkerpop/operators/test_gremlin.py
index 59fe2f6c504..203ec59b366 100644
---
a/providers/apache/tinkerpop/tests/unit/apache/tinkerpop/operators/test_gremlin.py
+++
b/providers/apache/tinkerpop/tests/unit/apache/tinkerpop/operators/test_gremlin.py
@@ -21,7 +21,7 @@ from unittest import mock
from airflow.models import Connection
from airflow.providers.apache.tinkerpop.operators.gremlin import
GremlinOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
DEFAULT_DATE = timezone.datetime(2015, 1, 1)
TEST_DAG_ID = "unit_test_dag"
diff --git a/providers/arangodb/tests/unit/arangodb/sensors/test_arangodb.py
b/providers/arangodb/tests/unit/arangodb/sensors/test_arangodb.py
index 71e9707b389..603a358cc9b 100644
--- a/providers/arangodb/tests/unit/arangodb/sensors/test_arangodb.py
+++ b/providers/arangodb/tests/unit/arangodb/sensors/test_arangodb.py
@@ -24,7 +24,7 @@ import pytest
from airflow.models import Connection
from airflow.models.dag import DAG
from airflow.providers.arangodb.sensors.arangodb import AQLSensor
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
# The tests do not create dag runs, so db isolation tests are skipped
diff --git
a/providers/atlassian/jira/tests/unit/atlassian/jira/operators/test_jira.py
b/providers/atlassian/jira/tests/unit/atlassian/jira/operators/test_jira.py
index 1e78d2b85fe..f4293f69c1e 100644
--- a/providers/atlassian/jira/tests/unit/atlassian/jira/operators/test_jira.py
+++ b/providers/atlassian/jira/tests/unit/atlassian/jira/operators/test_jira.py
@@ -23,7 +23,7 @@ import pytest
from airflow.models import Connection
from airflow.providers.atlassian.jira.operators.jira import JiraOperator
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
from tests_common.test_utils.compat import connection_as_json
diff --git
a/providers/atlassian/jira/tests/unit/atlassian/jira/sensors/test_jira.py
b/providers/atlassian/jira/tests/unit/atlassian/jira/sensors/test_jira.py
index 653c899d65e..b03eb058ebf 100644
--- a/providers/atlassian/jira/tests/unit/atlassian/jira/sensors/test_jira.py
+++ b/providers/atlassian/jira/tests/unit/atlassian/jira/sensors/test_jira.py
@@ -23,7 +23,7 @@ import pytest
from airflow.models import Connection
from airflow.providers.atlassian.jira.sensors.jira import JiraTicketSensor
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
from tests_common.test_utils.compat import connection_as_json
diff --git
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
index d99e3e294fb..60536cbb439 100644
--- a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
+++ b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
@@ -37,8 +37,7 @@ from airflow.providers.cncf.kubernetes.operators.job import (
)
from airflow.providers.cncf.kubernetes.triggers.job import KubernetesJobTrigger
from airflow.providers.cncf.kubernetes.utils.pod_manager import PodManager
-from airflow.providers.common.compat.sdk import AirflowException, TaskDeferred
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import AirflowException,
TaskDeferred, timezone
from airflow.utils.session import create_session
from airflow.utils.types import DagRunType
diff --git
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py
index 0e903ec644b..d01a98e84e6 100644
--- a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py
+++ b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py
@@ -56,8 +56,8 @@ from airflow.providers.common.compat.sdk import (
AirflowNotFoundException,
AirflowSkipException,
TaskDeferred,
+ timezone,
)
-from airflow.utils import timezone
from airflow.utils.session import create_session
from airflow.utils.types import DagRunType
diff --git
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_resource.py
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_resource.py
index 8c5e6d1f7ad..7711e7bec1e 100644
---
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_resource.py
+++
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_resource.py
@@ -27,8 +27,7 @@ from airflow.providers.cncf.kubernetes.operators.resource
import (
KubernetesCreateResourceOperator,
KubernetesDeleteResourceOperator,
)
-from airflow.providers.common.compat.sdk import AirflowException
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import AirflowException, timezone
TEST_VALID_RESOURCE_YAML = """
apiVersion: v1
diff --git
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_spark_kubernetes.py
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_spark_kubernetes.py
index 9a2f739266d..f645166ee12 100644
---
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_spark_kubernetes.py
+++
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_spark_kubernetes.py
@@ -38,8 +38,7 @@ from
airflow.providers.cncf.kubernetes.operators.spark_kubernetes import SparkKu
from airflow.providers.cncf.kubernetes.pod_generator import MAX_LABEL_LEN
from airflow.providers.cncf.kubernetes.triggers.pod import KubernetesPodTrigger
from airflow.providers.cncf.kubernetes.utils.pod_manager import PodPhase
-from airflow.providers.common.compat.sdk import TaskDeferred
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import TaskDeferred, timezone
from airflow.utils.types import DagRunType
from tests_common.test_utils.taskinstance import create_task_instance
diff --git
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
index 8517ab917ae..bd6dd73f210 100644
---
a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
+++
b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
@@ -27,8 +27,7 @@ from kubernetes.client.rest import ApiException
from airflow import DAG
from airflow.models import Connection
from airflow.providers.cncf.kubernetes.sensors.spark_kubernetes import
SparkKubernetesSensor
-from airflow.providers.common.compat.sdk import AirflowException
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import AirflowException, timezone
pytestmark = pytest.mark.db_test
diff --git
a/providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py
b/providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py
index c48f9ac877a..7ebaa370e22 100644
--- a/providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py
+++ b/providers/common/ai/tests/unit/common/ai/plugins/test_hitl_review.py
@@ -52,8 +52,8 @@ from airflow.providers.common.ai.utils.hitl_review import (
AgentSessionData,
SessionStatus,
)
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.standard.operators.empty import EmptyOperator
-from airflow.utils import timezone
from airflow.utils.session import provide_session
from airflow.utils.types import DagRunType
diff --git
a/providers/common/sql/tests/system/common/sql/example_generic_transfer.py
b/providers/common/sql/tests/system/common/sql/example_generic_transfer.py
index 28e64bc961b..1df1fdeea86 100644
--- a/providers/common/sql/tests/system/common/sql/example_generic_transfer.py
+++ b/providers/common/sql/tests/system/common/sql/example_generic_transfer.py
@@ -18,8 +18,8 @@
from __future__ import annotations
from airflow import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.common.sql.operators.generic_transfer import
GenericTransfer
-from airflow.utils import timezone
connection_args = {
"conn_id": "airflow_db",
diff --git
a/providers/common/sql/tests/system/common/sql/example_sql_column_table_check.py
b/providers/common/sql/tests/system/common/sql/example_sql_column_table_check.py
index de45dcfb2cc..79360b38379 100644
---
a/providers/common/sql/tests/system/common/sql/example_sql_column_table_check.py
+++
b/providers/common/sql/tests/system/common/sql/example_sql_column_table_check.py
@@ -18,8 +18,8 @@
from __future__ import annotations
from airflow import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator,
SQLTableCheckOperator
-from airflow.utils import timezone
AIRFLOW_DB_METADATA_TABLE = "ab_role"
connection_args = {
diff --git
a/providers/common/sql/tests/unit/common/sql/operators/test_generic_transfer.py
b/providers/common/sql/tests/unit/common/sql/operators/test_generic_transfer.py
index a268d232701..9bf069c0a6d 100644
---
a/providers/common/sql/tests/unit/common/sql/operators/test_generic_transfer.py
+++
b/providers/common/sql/tests/unit/common/sql/operators/test_generic_transfer.py
@@ -29,10 +29,10 @@ from more_itertools import flatten
from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.models.connection import Connection
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.mysql.hooks.mysql import MySqlHook
from airflow.providers.postgres.hooks.postgres import PostgresHook
-from airflow.utils import timezone
from tests_common.test_utils.compat import GenericTransfer
from tests_common.test_utils.operators.run_deferrable import execute_operator,
mock_context
diff --git a/providers/dbt/cloud/tests/unit/dbt/cloud/utils/test_openlineage.py
b/providers/dbt/cloud/tests/unit/dbt/cloud/utils/test_openlineage.py
index 32e7342c3e5..a44b528533c 100644
--- a/providers/dbt/cloud/tests/unit/dbt/cloud/utils/test_openlineage.py
+++ b/providers/dbt/cloud/tests/unit/dbt/cloud/utils/test_openlineage.py
@@ -24,7 +24,7 @@ import pytest
from openlineage.client.constants import __version__
from packaging.version import parse
-from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
+from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException, timezone
from airflow.providers.dbt.cloud.hooks.dbt import DbtCloudHook
from airflow.providers.dbt.cloud.operators.dbt import DbtCloudRunJobOperator
from airflow.providers.dbt.cloud.utils.openlineage import (
@@ -33,7 +33,6 @@ from airflow.providers.dbt.cloud.utils.openlineage import (
)
from airflow.providers.openlineage.conf import namespace
from airflow.providers.openlineage.extractors import OperatorLineage
-from airflow.utils import timezone
from airflow.utils.state import TaskInstanceState
TASK_ID = "dbt_test"
diff --git a/providers/dingding/tests/unit/dingding/operators/test_dingding.py
b/providers/dingding/tests/unit/dingding/operators/test_dingding.py
index c138ff56a3b..5d5ca239468 100644
--- a/providers/dingding/tests/unit/dingding/operators/test_dingding.py
+++ b/providers/dingding/tests/unit/dingding/operators/test_dingding.py
@@ -20,8 +20,8 @@ from __future__ import annotations
from unittest import mock
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.dingding.operators.dingding import DingdingOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/discord/tests/unit/discord/operators/test_discord_webhook.py
b/providers/discord/tests/unit/discord/operators/test_discord_webhook.py
index baaf33cde38..03543562c1b 100644
--- a/providers/discord/tests/unit/discord/operators/test_discord_webhook.py
+++ b/providers/discord/tests/unit/discord/operators/test_discord_webhook.py
@@ -18,8 +18,8 @@
from __future__ import annotations
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.discord.operators.discord_webhook import
DiscordWebhookOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2018, 1, 1)
diff --git
a/providers/elasticsearch/tests/unit/elasticsearch/log/test_es_task_handler.py
b/providers/elasticsearch/tests/unit/elasticsearch/log/test_es_task_handler.py
index 9f7091d90bb..a2cb4c315d8 100644
---
a/providers/elasticsearch/tests/unit/elasticsearch/log/test_es_task_handler.py
+++
b/providers/elasticsearch/tests/unit/elasticsearch/log/test_es_task_handler.py
@@ -31,7 +31,7 @@ import elasticsearch
import pendulum
import pytest
-from airflow.providers.common.compat.sdk import conf
+from airflow.providers.common.compat.sdk import conf, timezone
from airflow.providers.elasticsearch.log.es_json_formatter import
ElasticsearchJSONFormatter
from airflow.providers.elasticsearch.log.es_response import
ElasticSearchResponse
from airflow.providers.elasticsearch.log.es_task_handler import (
@@ -48,10 +48,8 @@ from airflow.providers.elasticsearch.log.es_task_handler
import (
get_es_kwargs_from_config,
getattr_nested,
)
-from airflow.utils import timezone
from airflow.utils.log.file_task_handler import FileTaskHandler
from airflow.utils.state import DagRunState, TaskInstanceState
-from airflow.utils.timezone import datetime
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
@@ -160,7 +158,7 @@ class TestElasticsearchTaskHandler:
RUN_ID = "run_for_testing_es_log_handler"
MAP_INDEX = -1
TRY_NUM = 1
- LOGICAL_DATE = datetime(2016, 1, 1)
+ LOGICAL_DATE = timezone.datetime(2016, 1, 1)
LOG_ID = f"{DAG_ID}-{TASK_ID}-{RUN_ID}-{MAP_INDEX}-{TRY_NUM}"
FILENAME_TEMPLATE = "{try_number}.log"
@@ -518,7 +516,7 @@ class TestElasticsearchTaskHandler:
assert _render_log_id(self.es_task_handler.log_id_template, ti, 1) ==
self.LOG_ID
def test_clean_date(self):
- clean_logical_date = _clean_date(datetime(2016, 7, 8, 9, 10, 11, 12))
+ clean_logical_date = _clean_date(timezone.datetime(2016, 7, 8, 9, 10,
11, 12))
assert clean_logical_date == "2016_07_08T09_10_11_000012"
@pytest.mark.db_test
diff --git a/providers/ftp/tests/unit/ftp/operators/test_ftp.py
b/providers/ftp/tests/unit/ftp/operators/test_ftp.py
index c4c96e371db..613cf1ef464 100644
--- a/providers/ftp/tests/unit/ftp/operators/test_ftp.py
+++ b/providers/ftp/tests/unit/ftp/operators/test_ftp.py
@@ -24,15 +24,14 @@ import pytest
from airflow.models import DAG, Connection
from airflow.providers.common.compat.openlineage.facet import Dataset
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.ftp.operators.ftp import (
FTPFileTransmitOperator,
FTPOperation,
FTPSFileTransmitOperator,
)
-from airflow.utils import timezone
-from airflow.utils.timezone import datetime
-DEFAULT_DATE = datetime(2017, 1, 1)
+DEFAULT_DATE = timezone.datetime(2017, 1, 1)
DEFAULT_CONN_ID = "ftp_default"
diff --git
a/providers/google/src/airflow/providers/google/cloud/operators/gcs.py
b/providers/google/src/airflow/providers/google/cloud/operators/gcs.py
index c649962b217..056d16c6c23 100644
--- a/providers/google/src/airflow/providers/google/cloud/operators/gcs.py
+++ b/providers/google/src/airflow/providers/google/cloud/operators/gcs.py
@@ -40,11 +40,10 @@ from google.api_core.exceptions import Conflict
from google.cloud.exceptions import GoogleCloudError
from airflow.exceptions import AirflowProviderDeprecationWarning
-from airflow.providers.common.compat.sdk import AirflowException
+from airflow.providers.common.compat.sdk import AirflowException, timezone
from airflow.providers.google.cloud.hooks.gcs import GCSHook
from airflow.providers.google.cloud.operators.cloud_base import
GoogleCloudBaseOperator
from airflow.providers.google.common.links.storage import FileDetailsLink,
StorageLink
-from airflow.utils import timezone
class GCSCreateBucketOperator(GoogleCloudBaseOperator):
diff --git
a/providers/google/src/airflow/providers/google/cloud/triggers/gcs.py
b/providers/google/src/airflow/providers/google/cloud/triggers/gcs.py
index c0e1b422e7f..e40bafebff7 100644
--- a/providers/google/src/airflow/providers/google/cloud/triggers/gcs.py
+++ b/providers/google/src/airflow/providers/google/cloud/triggers/gcs.py
@@ -25,9 +25,9 @@ from typing import Any
from aiohttp import ClientSession
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.cloud.hooks.gcs import GCSAsyncHook
from airflow.triggers.base import BaseTrigger, TriggerEvent
-from airflow.utils import timezone
class GCSBlobTrigger(BaseTrigger):
diff --git
a/providers/google/tests/unit/google/cloud/log/test_stackdriver_task_handler.py
b/providers/google/tests/unit/google/cloud/log/test_stackdriver_task_handler.py
index da0068ae67b..de4fd3e0cdb 100644
---
a/providers/google/tests/unit/google/cloud/log/test_stackdriver_task_handler.py
+++
b/providers/google/tests/unit/google/cloud/log/test_stackdriver_task_handler.py
@@ -27,11 +27,11 @@ import pytest
from google.cloud.logging import Resource
from google.cloud.logging_v2.types import ListLogEntriesRequest,
ListLogEntriesResponse, LogEntry
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.cloud.log.stackdriver_task_handler import (
StackdriverRemoteLogIO,
StackdriverTaskHandler,
)
-from airflow.utils import timezone
from airflow.utils.state import TaskInstanceState
from tests_common.test_utils.config import conf_vars
diff --git
a/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
b/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
index 248a5e3a2d4..3b24428ac1b 100644
---
a/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
+++
b/providers/google/tests/unit/google/cloud/operators/test_cloud_storage_transfer_service.py
@@ -25,7 +25,7 @@ import pytest
import time_machine
from botocore.credentials import Credentials
-from airflow.providers.common.compat.sdk import AirflowException, TaskDeferred
+from airflow.providers.common.compat.sdk import AirflowException,
TaskDeferred, timezone
from airflow.providers.google.cloud.hooks.cloud_storage_transfer_service
import (
ACCESS_KEY_ID,
AWS_ACCESS_KEY,
@@ -71,7 +71,6 @@ from
airflow.providers.google.cloud.operators.cloud_storage_transfer_service imp
from airflow.providers.google.cloud.triggers.cloud_storage_transfer_service
import (
CloudStorageTransferServiceCheckJobStatusTrigger,
)
-from airflow.utils import timezone
try:
import boto3
diff --git a/providers/google/tests/unit/google/cloud/operators/test_compute.py
b/providers/google/tests/unit/google/cloud/operators/test_compute.py
index 2ca63771275..8919665c599 100644
--- a/providers/google/tests/unit/google/cloud/operators/test_compute.py
+++ b/providers/google/tests/unit/google/cloud/operators/test_compute.py
@@ -27,7 +27,7 @@ from google.api_core.exceptions import NotFound
from google.api_core.retry import Retry
from google.cloud.compute_v1.types import Instance, InstanceGroupManager,
InstanceTemplate
-from airflow.providers.common.compat.sdk import AirflowException
+from airflow.providers.common.compat.sdk import AirflowException, timezone
from airflow.providers.google.cloud.operators.compute import (
ComputeEngineCopyInstanceTemplateOperator,
ComputeEngineDeleteInstanceGroupManagerOperator,
@@ -42,7 +42,6 @@ from airflow.providers.google.cloud.operators.compute import (
ComputeEngineStartInstanceOperator,
ComputeEngineStopInstanceOperator,
)
-from airflow.utils import timezone
EMPTY_CONTENT = b""
GCP_PROJECT_ID = "project-id"
diff --git
a/providers/google/tests/unit/google/marketing_platform/operators/test_bid_manager.py
b/providers/google/tests/unit/google/marketing_platform/operators/test_bid_manager.py
index 79db1a7b0e3..1f7b2928f7d 100644
---
a/providers/google/tests/unit/google/marketing_platform/operators/test_bid_manager.py
+++
b/providers/google/tests/unit/google/marketing_platform/operators/test_bid_manager.py
@@ -26,13 +26,13 @@ from sqlalchemy import delete
from airflow.exceptions import AirflowException
from airflow.models import TaskInstance as TI
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.marketing_platform.operators.bid_manager import (
GoogleBidManagerCreateQueryOperator,
GoogleBidManagerDeleteQueryOperator,
GoogleBidManagerDownloadReportOperator,
GoogleBidManagerRunQueryOperator,
)
-from airflow.utils import timezone
from airflow.utils.session import create_session
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
diff --git
a/providers/google/tests/unit/google/marketing_platform/operators/test_campaign_manager.py
b/providers/google/tests/unit/google/marketing_platform/operators/test_campaign_manager.py
index 20bfaa940ab..dca13918d01 100644
---
a/providers/google/tests/unit/google/marketing_platform/operators/test_campaign_manager.py
+++
b/providers/google/tests/unit/google/marketing_platform/operators/test_campaign_manager.py
@@ -25,6 +25,7 @@ import pytest
from sqlalchemy import delete
from airflow.models import TaskInstance as TI
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.marketing_platform.operators.campaign_manager
import (
GoogleCampaignManagerBatchInsertConversionsOperator,
GoogleCampaignManagerBatchUpdateConversionsOperator,
@@ -33,7 +34,6 @@ from
airflow.providers.google.marketing_platform.operators.campaign_manager impo
GoogleCampaignManagerInsertReportOperator,
GoogleCampaignManagerRunReportOperator,
)
-from airflow.utils import timezone
from airflow.utils.session import create_session
from tests_common.test_utils.taskinstance import run_task_instance
diff --git
a/providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
b/providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
index 28dab42c7b6..6e80bd973e0 100644
---
a/providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
+++
b/providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
@@ -19,11 +19,11 @@ from __future__ import annotations
from unittest import mock
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.marketing_platform.operators.display_video
import (
GoogleDisplayVideo360CreateSDFDownloadTaskOperator,
GoogleDisplayVideo360SDFtoGCSOperator,
)
-from airflow.utils import timezone
API_VERSION = "v4"
GCP_CONN_ID = "google_cloud_default"
diff --git
a/providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/batch.py
b/providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/batch.py
index 06f0cf8710f..be7c21ef3d5 100644
---
a/providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/batch.py
+++
b/providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/batch.py
@@ -24,13 +24,12 @@ from typing import TYPE_CHECKING, Any
from azure.batch import BatchServiceClient, batch_auth, models as batch_models
-from airflow.providers.common.compat.sdk import AirflowException, BaseHook
+from airflow.providers.common.compat.sdk import AirflowException, BaseHook,
timezone
from airflow.providers.microsoft.azure.utils import (
AzureIdentityCredentialAdapter,
add_managed_identity_connection_widgets,
get_field,
)
-from airflow.utils import timezone
if TYPE_CHECKING:
from azure.batch.models import JobAddParameter, PoolAddParameter,
TaskAddParameter
diff --git
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_data_factory.py
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_data_factory.py
index 7804891fd4b..ac31c8b40b8 100644
---
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_data_factory.py
+++
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_data_factory.py
@@ -28,7 +28,7 @@ import pytest
from airflow.models import DAG, Connection
from airflow.models.dagrun import DagRun
from airflow.models.taskinstance import TaskInstance
-from airflow.providers.common.compat.sdk import AirflowException, TaskDeferred
+from airflow.providers.common.compat.sdk import AirflowException,
TaskDeferred, timezone
from airflow.providers.microsoft.azure.hooks.data_factory import (
AzureDataFactoryHook,
AzureDataFactoryPipelineRunException,
@@ -36,7 +36,6 @@ from airflow.providers.microsoft.azure.hooks.data_factory
import (
)
from airflow.providers.microsoft.azure.operators.data_factory import
AzureDataFactoryRunPipelineOperator
from airflow.providers.microsoft.azure.triggers.data_factory import
AzureDataFactoryTrigger
-from airflow.utils import timezone
from airflow.utils.types import DagRunType
from tests_common.test_utils.taskinstance import create_task_instance as
_create_task_instance
diff --git
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_synapse.py
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_synapse.py
index 419e34c00eb..721b245608c 100644
---
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_synapse.py
+++
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_synapse.py
@@ -27,7 +27,7 @@ import pytest
from airflow.models import DAG, Connection
from airflow.models.dagrun import DagRun
from airflow.models.taskinstance import TaskInstance
-from airflow.providers.common.compat.sdk import AirflowException, TaskDeferred
+from airflow.providers.common.compat.sdk import AirflowException,
TaskDeferred, timezone
from airflow.providers.microsoft.azure.hooks.synapse import (
AzureSynapsePipelineHook,
AzureSynapsePipelineRunException,
@@ -39,7 +39,6 @@ from airflow.providers.microsoft.azure.operators.synapse
import (
AzureSynapseRunSparkBatchOperator,
)
from airflow.providers.microsoft.azure.triggers.synapse import
AzureSynapsePipelineTrigger
-from airflow.utils import timezone
from airflow.utils.types import DagRunType
from tests_common.test_utils.taskinstance import create_task_instance as
_create_task_instance
diff --git
a/providers/microsoft/azure/tests/unit/microsoft/azure/sensors/test_wasb.py
b/providers/microsoft/azure/tests/unit/microsoft/azure/sensors/test_wasb.py
index 3108b67656f..0b35c5d9947 100644
--- a/providers/microsoft/azure/tests/unit/microsoft/azure/sensors/test_wasb.py
+++ b/providers/microsoft/azure/tests/unit/microsoft/azure/sensors/test_wasb.py
@@ -28,10 +28,9 @@ from airflow.models import Connection
from airflow.models.dag import DAG
from airflow.models.dagrun import DagRun
from airflow.models.taskinstance import TaskInstance
-from airflow.providers.common.compat.sdk import AirflowException, TaskDeferred
+from airflow.providers.common.compat.sdk import AirflowException,
TaskDeferred, timezone
from airflow.providers.microsoft.azure.sensors.wasb import WasbBlobSensor,
WasbPrefixSensor
from airflow.providers.microsoft.azure.triggers.wasb import
WasbBlobSensorTrigger, WasbPrefixSensorTrigger
-from airflow.utils import timezone
from airflow.utils.types import DagRunType
from tests_common.test_utils.taskinstance import create_task_instance
diff --git a/providers/mongo/tests/integration/mongo/sensors/test_mongo.py
b/providers/mongo/tests/integration/mongo/sensors/test_mongo.py
index 523e6e1c04b..6781426ed45 100644
--- a/providers/mongo/tests/integration/mongo/sensors/test_mongo.py
+++ b/providers/mongo/tests/integration/mongo/sensors/test_mongo.py
@@ -21,9 +21,9 @@ import pytest
from airflow.models import Connection
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.mongo.hooks.mongo import MongoHook
from airflow.providers.mongo.sensors.mongo import MongoSensor
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/mongo/tests/unit/mongo/sensors/test_mongo.py
b/providers/mongo/tests/unit/mongo/sensors/test_mongo.py
index 874beb9bf1e..2efcdb9f764 100644
--- a/providers/mongo/tests/unit/mongo/sensors/test_mongo.py
+++ b/providers/mongo/tests/unit/mongo/sensors/test_mongo.py
@@ -20,9 +20,9 @@ from __future__ import annotations
from unittest.mock import patch
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.mongo.hooks.mongo import MongoHook
from airflow.providers.mongo.sensors.mongo import MongoSensor
-from airflow.utils import timezone
from tests_common.test_utils.compat import Context
diff --git
a/providers/openlineage/tests/unit/openlineage/plugins/test_execution.py
b/providers/openlineage/tests/unit/openlineage/plugins/test_execution.py
index 256e873f55e..42b9b9d0ef1 100644
--- a/providers/openlineage/tests/unit/openlineage/plugins/test_execution.py
+++ b/providers/openlineage/tests/unit/openlineage/plugins/test_execution.py
@@ -28,9 +28,9 @@ import pytest
from airflow.jobs.job import Job
from airflow.models import TaskInstance
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.google.cloud.openlineage.utils import
get_from_nullable_chain
from airflow.providers.openlineage.plugins.listener import OpenLineageListener
-from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
diff --git
a/providers/opensearch/tests/unit/opensearch/log/test_os_task_handler.py
b/providers/opensearch/tests/unit/opensearch/log/test_os_task_handler.py
index e9464e53e3d..7ec7281f039 100644
--- a/providers/opensearch/tests/unit/opensearch/log/test_os_task_handler.py
+++ b/providers/opensearch/tests/unit/opensearch/log/test_os_task_handler.py
@@ -29,7 +29,7 @@ import pendulum
import pytest
from opensearchpy.exceptions import NotFoundError
-from airflow.providers.common.compat.sdk import conf
+from airflow.providers.common.compat.sdk import conf, timezone
from airflow.providers.opensearch.log.os_json_formatter import
OpensearchJSONFormatter
from airflow.providers.opensearch.log.os_response import OpensearchResponse
from airflow.providers.opensearch.log.os_task_handler import (
@@ -43,10 +43,8 @@ from airflow.providers.opensearch.log.os_task_handler import
(
get_os_kwargs_from_config,
getattr_nested,
)
-from airflow.utils import timezone
from airflow.utils.log.file_task_handler import FileTaskHandler
from airflow.utils.state import DagRunState, TaskInstanceState
-from airflow.utils.timezone import datetime
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
@@ -150,7 +148,7 @@ def _assert_missing_log_message(logs):
class TestOpensearchTaskHandler:
DAG_ID = "dag_for_testing_os_task_handler"
TASK_ID = "task_for_testing_os_log_handler"
- LOGICAL_DATE = datetime(2016, 1, 1)
+ LOGICAL_DATE = timezone.datetime(2016, 1, 1)
LOG_ID = f"{DAG_ID}-{TASK_ID}-2016-01-01T00:00:00+00:00-1"
JSON_LOG_ID =
f"{DAG_ID}-{TASK_ID}-{OpensearchTaskHandler._clean_date(LOGICAL_DATE)}-1"
FILENAME_TEMPLATE = "{try_number}.log"
@@ -537,7 +535,7 @@ class TestOpensearchTaskHandler:
assert self.os_task_handler._render_log_id(ti, 1) == self.JSON_LOG_ID
def test_clean_date(self):
- clean_logical_date = OpensearchTaskHandler._clean_date(datetime(2016,
7, 8, 9, 10, 11, 12))
+ clean_logical_date =
OpensearchTaskHandler._clean_date(timezone.datetime(2016, 7, 8, 9, 10, 11, 12))
assert clean_logical_date == "2016_07_08T09_10_11_000012"
@pytest.mark.db_test
diff --git a/providers/opsgenie/tests/unit/opsgenie/operators/test_opsgenie.py
b/providers/opsgenie/tests/unit/opsgenie/operators/test_opsgenie.py
index 4fda7e1b604..d73ff9cd2f4 100644
--- a/providers/opsgenie/tests/unit/opsgenie/operators/test_opsgenie.py
+++ b/providers/opsgenie/tests/unit/opsgenie/operators/test_opsgenie.py
@@ -20,12 +20,12 @@ from __future__ import annotations
from unittest import mock
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.opsgenie.operators.opsgenie import (
OpsgenieCloseAlertOperator,
OpsgenieCreateAlertOperator,
OpsgenieDeleteAlertOperator,
)
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/papermill/tests/unit/papermill/operators/test_papermill.py
b/providers/papermill/tests/unit/papermill/operators/test_papermill.py
index b18c9e84023..479baaed610 100644
--- a/providers/papermill/tests/unit/papermill/operators/test_papermill.py
+++ b/providers/papermill/tests/unit/papermill/operators/test_papermill.py
@@ -21,8 +21,8 @@ from unittest.mock import MagicMock, patch
import pytest
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.papermill.operators.papermill import PapermillOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2021, 1, 1)
TEST_INPUT_URL = "/foo/bar"
diff --git
a/providers/qdrant/tests/integration/qdrant/operators/test_qdrant_ingest.py
b/providers/qdrant/tests/integration/qdrant/operators/test_qdrant_ingest.py
index 6aded06fffe..23a92d704b1 100644
--- a/providers/qdrant/tests/integration/qdrant/operators/test_qdrant_ingest.py
+++ b/providers/qdrant/tests/integration/qdrant/operators/test_qdrant_ingest.py
@@ -24,8 +24,8 @@ import pytest
from qdrant_client.models import Distance, VectorParams
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.qdrant.operators.qdrant import QdrantIngestOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2024, 1, 1)
diff --git
a/providers/redis/tests/integration/redis/operators/test_redis_publish.py
b/providers/redis/tests/integration/redis/operators/test_redis_publish.py
index 76fd02f02c0..b33d573897b 100644
--- a/providers/redis/tests/integration/redis/operators/test_redis_publish.py
+++ b/providers/redis/tests/integration/redis/operators/test_redis_publish.py
@@ -22,9 +22,9 @@ from unittest.mock import MagicMock
import pytest
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.hooks.redis import RedisHook
from airflow.providers.redis.operators.redis_publish import
RedisPublishOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/redis/tests/integration/redis/sensors/test_redis_key.py
b/providers/redis/tests/integration/redis/sensors/test_redis_key.py
index f54e816c29a..1dcd6ce86dd 100644
--- a/providers/redis/tests/integration/redis/sensors/test_redis_key.py
+++ b/providers/redis/tests/integration/redis/sensors/test_redis_key.py
@@ -20,9 +20,9 @@ from __future__ import annotations
import pytest
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.hooks.redis import RedisHook
from airflow.providers.redis.sensors.redis_key import RedisKeySensor
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git
a/providers/redis/tests/integration/redis/sensors/test_redis_pub_sub.py
b/providers/redis/tests/integration/redis/sensors/test_redis_pub_sub.py
index 55bc9845bae..f75bca92248 100644
--- a/providers/redis/tests/integration/redis/sensors/test_redis_pub_sub.py
+++ b/providers/redis/tests/integration/redis/sensors/test_redis_pub_sub.py
@@ -23,9 +23,9 @@ from unittest.mock import MagicMock, call
import pytest
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.hooks.redis import RedisHook
from airflow.providers.redis.sensors.redis_pub_sub import RedisPubSubSensor
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/redis/tests/unit/redis/operators/test_redis_publish.py
b/providers/redis/tests/unit/redis/operators/test_redis_publish.py
index cb3d16144c1..587cef2688b 100644
--- a/providers/redis/tests/unit/redis/operators/test_redis_publish.py
+++ b/providers/redis/tests/unit/redis/operators/test_redis_publish.py
@@ -20,8 +20,8 @@ from __future__ import annotations
from unittest.mock import MagicMock, patch
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.operators.redis_publish import
RedisPublishOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/redis/tests/unit/redis/sensors/test_redis_key.py
b/providers/redis/tests/unit/redis/sensors/test_redis_key.py
index 7012ed5ccf2..1a0313832c3 100644
--- a/providers/redis/tests/unit/redis/sensors/test_redis_key.py
+++ b/providers/redis/tests/unit/redis/sensors/test_redis_key.py
@@ -20,8 +20,8 @@ from __future__ import annotations
from unittest.mock import MagicMock, patch
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.sensors.redis_key import RedisKeySensor
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/redis/tests/unit/redis/sensors/test_redis_pub_sub.py
b/providers/redis/tests/unit/redis/sensors/test_redis_pub_sub.py
index 31c0a2f6072..a06e2b60797 100644
--- a/providers/redis/tests/unit/redis/sensors/test_redis_pub_sub.py
+++ b/providers/redis/tests/unit/redis/sensors/test_redis_pub_sub.py
@@ -20,8 +20,8 @@ from __future__ import annotations
from unittest.mock import MagicMock, call, patch
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.redis.sensors.redis_pub_sub import RedisPubSubSensor
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
diff --git a/providers/sftp/tests/unit/sftp/decorators/sensors/test_sftp.py
b/providers/sftp/tests/unit/sftp/decorators/sensors/test_sftp.py
index 6fa81f19469..0ff494fc6d1 100644
--- a/providers/sftp/tests/unit/sftp/decorators/sensors/test_sftp.py
+++ b/providers/sftp/tests/unit/sftp/decorators/sensors/test_sftp.py
@@ -26,7 +26,7 @@ if AIRFLOW_V_3_0_PLUS:
from airflow.sdk import task
else:
from airflow.decorators import task # type: ignore[attr-defined,no-redef]
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
pytestmark = pytest.mark.db_test
diff --git a/providers/sftp/tests/unit/sftp/operators/test_sftp.py
b/providers/sftp/tests/unit/sftp/operators/test_sftp.py
index 815d9813201..e862f8be538 100644
--- a/providers/sftp/tests/unit/sftp/operators/test_sftp.py
+++ b/providers/sftp/tests/unit/sftp/operators/test_sftp.py
@@ -30,13 +30,11 @@ import pytest
from airflow.models import DAG, Connection
from airflow.providers.common.compat.openlineage.facet import Dataset
-from airflow.providers.common.compat.sdk import AirflowException
+from airflow.providers.common.compat.sdk import AirflowException, timezone
from airflow.providers.sftp.hooks.sftp import SFTPHook
from airflow.providers.sftp.operators.sftp import SFTPOperation, SFTPOperator
from airflow.providers.ssh.hooks.ssh import SSHHook
from airflow.providers.ssh.operators.ssh import SSHOperator
-from airflow.utils import timezone
-from airflow.utils.timezone import datetime
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
@@ -44,7 +42,7 @@ from tests_common.test_utils.version_compat import
AIRFLOW_V_3_0_PLUS
pytestmark = pytest.mark.db_test
-DEFAULT_DATE = datetime(2017, 1, 1)
+DEFAULT_DATE = timezone.datetime(2017, 1, 1)
TEST_CONN_ID = "conn_id_for_testing"
LOCAL_FILEPATH = "/path/local"
diff --git
a/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py
b/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py
index fdd55893ca0..c8e3fd1d105 100644
--- a/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py
+++ b/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py
@@ -40,13 +40,13 @@ from airflow.providers.common.compat.sdk import (
AirflowOptionalProviderFeatureException,
Connection,
conf,
+ timezone,
)
from airflow.providers.common.sql.hooks import handlers as sql_handlers
from airflow.providers.common.sql.hooks.handlers import
return_single_query_results
from airflow.providers.common.sql.hooks.lineage import send_sql_hook_lineage
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.snowflake.utils.openlineage import
fix_snowflake_sqlalchemy_uri
-from airflow.utils import timezone
from airflow.utils.strings import to_boolean
OAUTH_REQUEST_TIMEOUT = 30 # seconds, avoid hanging tasks on token request
diff --git
a/providers/snowflake/src/airflow/providers/snowflake/utils/openlineage.py
b/providers/snowflake/src/airflow/providers/snowflake/utils/openlineage.py
index 483f176cf59..0dd70c7493b 100644
--- a/providers/snowflake/src/airflow/providers/snowflake/utils/openlineage.py
+++ b/providers/snowflake/src/airflow/providers/snowflake/utils/openlineage.py
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, Any
from urllib.parse import quote, urlparse, urlunparse
from airflow.providers.common.compat.openlineage.check import
require_openlineage_version
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
if TYPE_CHECKING:
from openlineage.client.event_v2 import RunEvent
diff --git
a/providers/snowflake/tests/unit/snowflake/decorators/test_snowpark.py
b/providers/snowflake/tests/unit/snowflake/decorators/test_snowpark.py
index b3af126763f..b8cec8e1da0 100644
--- a/providers/snowflake/tests/unit/snowflake/decorators/test_snowpark.py
+++ b/providers/snowflake/tests/unit/snowflake/decorators/test_snowpark.py
@@ -26,8 +26,7 @@ import pytest
pytest.importorskip("snowflake.snowpark")
-from airflow.providers.common.compat.sdk import task
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import task, timezone
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
diff --git a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
index d0fdb49b5b5..5986f034e60 100644
--- a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
+++ b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py
@@ -33,9 +33,8 @@ from cryptography.hazmat.primitives.asymmetric import rsa
from requests.exceptions import ConnectionError, HTTPError
from airflow.models import Connection
-from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
+from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException, timezone
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
-from airflow.utils import timezone
if TYPE_CHECKING:
from pathlib import Path
diff --git
a/providers/snowflake/tests/unit/snowflake/operators/test_snowpark.py
b/providers/snowflake/tests/unit/snowflake/operators/test_snowpark.py
index 38fcdffe13f..6dfda2a81aa 100644
--- a/providers/snowflake/tests/unit/snowflake/operators/test_snowpark.py
+++ b/providers/snowflake/tests/unit/snowflake/operators/test_snowpark.py
@@ -25,8 +25,8 @@ import pytest
pytest.importorskip("snowflake.snowpark")
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.snowflake.operators.snowpark import SnowparkOperator
-from airflow.utils import timezone
if TYPE_CHECKING:
from snowflake.snowpark import Session
diff --git a/providers/snowflake/tests/unit/snowflake/utils/test_openlineage.py
b/providers/snowflake/tests/unit/snowflake/utils/test_openlineage.py
index cc7eabb2f23..a460aa213e8 100644
--- a/providers/snowflake/tests/unit/snowflake/utils/test_openlineage.py
+++ b/providers/snowflake/tests/unit/snowflake/utils/test_openlineage.py
@@ -29,7 +29,7 @@ from airflow.providers.common.compat.openlineage.facet import
(
ExternalQueryRunFacet,
SQLJobFacet,
)
-from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException
+from airflow.providers.common.compat.sdk import
AirflowOptionalProviderFeatureException, timezone
from airflow.providers.openlineage.conf import namespace
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
from airflow.providers.snowflake.hooks.snowflake_sql_api import
SnowflakeSqlApiHook
@@ -44,7 +44,6 @@ from airflow.providers.snowflake.utils.openlineage import (
fix_account_name,
fix_snowflake_sqlalchemy_uri,
)
-from airflow.utils import timezone
from airflow.utils.state import TaskInstanceState
diff --git
a/providers/standard/tests/unit/standard/decorators/test_python_virtualenv.py
b/providers/standard/tests/unit/standard/decorators/test_python_virtualenv.py
index a324fceac0a..cc02d92a3b1 100644
---
a/providers/standard/tests/unit/standard/decorators/test_python_virtualenv.py
+++
b/providers/standard/tests/unit/standard/decorators/test_python_virtualenv.py
@@ -25,7 +25,7 @@ from typing import Any
import pytest
-from airflow.utils import timezone
+from airflow.providers.common.compat.sdk import timezone
from airflow.utils.state import TaskInstanceState
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
diff --git a/providers/standard/tests/unit/standard/operators/test_bash.py
b/providers/standard/tests/unit/standard/operators/test_bash.py
index 8837fc81b7b..1a8aad37981 100644
--- a/providers/standard/tests/unit/standard/operators/test_bash.py
+++ b/providers/standard/tests/unit/standard/operators/test_bash.py
@@ -27,9 +27,13 @@ from unittest import mock
import pytest
-from airflow.providers.common.compat.sdk import AirflowException,
AirflowSkipException, AirflowTaskTimeout
+from airflow.providers.common.compat.sdk import (
+ AirflowException,
+ AirflowSkipException,
+ AirflowTaskTimeout,
+ timezone,
+)
from airflow.providers.standard.operators.bash import BashOperator
-from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
diff --git
a/providers/standard/tests/unit/standard/operators/test_branch_operator.py
b/providers/standard/tests/unit/standard/operators/test_branch_operator.py
index c58e0ff9cf3..e05d3863bce 100644
--- a/providers/standard/tests/unit/standard/operators/test_branch_operator.py
+++ b/providers/standard/tests/unit/standard/operators/test_branch_operator.py
@@ -23,11 +23,11 @@ import pytest
from sqlalchemy import select
from airflow.models.taskinstance import TaskInstance as TI
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.standard.operators.branch import BaseBranchOperator
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.providers.standard.utils.skipmixin import
XCOM_SKIPMIXIN_FOLLOWED, XCOM_SKIPMIXIN_KEY
from airflow.timetables.base import DataInterval
-from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
diff --git
a/providers/standard/tests/unit/standard/operators/test_latest_only_operator.py
b/providers/standard/tests/unit/standard/operators/test_latest_only_operator.py
index fa48ae0fedd..62cc653dfd5 100644
---
a/providers/standard/tests/unit/standard/operators/test_latest_only_operator.py
+++
b/providers/standard/tests/unit/standard/operators/test_latest_only_operator.py
@@ -34,8 +34,8 @@ try:
except ImportError:
# Compatibility for Airflow < 3.1
from airflow.utils.trigger_rule import TriggerRule # type:
ignore[no-redef,attr-defined]
+from airflow.providers.common.compat.sdk import timezone
from airflow.timetables.base import DataInterval
-from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types import DagRunType
diff --git a/providers/standard/tests/unit/standard/operators/test_weekday.py
b/providers/standard/tests/unit/standard/operators/test_weekday.py
index 9836a8b9efb..957c94e7295 100644
--- a/providers/standard/tests/unit/standard/operators/test_weekday.py
+++ b/providers/standard/tests/unit/standard/operators/test_weekday.py
@@ -25,13 +25,12 @@ from sqlalchemy import delete
from airflow.models.dagrun import DagRun
from airflow.models.taskinstance import TaskInstance as TI
-from airflow.providers.common.compat.sdk import AirflowException
+from airflow.providers.common.compat.sdk import AirflowException, timezone
from airflow.providers.common.compat.standard.utils import
XCOM_SKIPMIXIN_FOLLOWED, XCOM_SKIPMIXIN_KEY
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.providers.standard.operators.weekday import
BranchDayOfWeekOperator
from airflow.providers.standard.utils.weekday import WeekDay
from airflow.timetables.base import DataInterval
-from airflow.utils import timezone
from airflow.utils.session import create_session
from airflow.utils.state import State
diff --git
a/providers/standard/tests/unit/standard/triggers/test_external_task.py
b/providers/standard/tests/unit/standard/triggers/test_external_task.py
index 840afb343e2..09ba4ca6950 100644
--- a/providers/standard/tests/unit/standard/triggers/test_external_task.py
+++ b/providers/standard/tests/unit/standard/triggers/test_external_task.py
@@ -24,9 +24,9 @@ import pytest
from airflow.models.dag import DAG
from airflow.models.dagrun import DagRun
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.standard.triggers.external_task import DagStateTrigger,
WorkflowTrigger
from airflow.triggers.base import TriggerEvent
-from airflow.utils import timezone
from airflow.utils.state import DagRunState
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
diff --git a/providers/standard/tests/unit/standard/triggers/test_temporal.py
b/providers/standard/tests/unit/standard/triggers/test_temporal.py
index fd2e3596a62..9a3b2c423d4 100644
--- a/providers/standard/tests/unit/standard/triggers/test_temporal.py
+++ b/providers/standard/tests/unit/standard/triggers/test_temporal.py
@@ -23,11 +23,13 @@ from unittest import mock
import pendulum
import pytest
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.standard.triggers.temporal import DateTimeTrigger,
TimeDeltaTrigger
from airflow.triggers.base import TriggerEvent
-from airflow.utils import timezone
from airflow.utils.state import TaskInstanceState
-from airflow.utils.timezone import utcnow
+
+# Bound at import time so tests patching ``temporal.timezone.utcnow`` still
read a real clock here.
+utcnow = timezone.utcnow
def test_input_validation():
diff --git a/providers/ydb/tests/integration/ydb/operators/test_ydb.py
b/providers/ydb/tests/integration/ydb/operators/test_ydb.py
index 84cef2fad8a..055cc5c07be 100644
--- a/providers/ydb/tests/integration/ydb/operators/test_ydb.py
+++ b/providers/ydb/tests/integration/ydb/operators/test_ydb.py
@@ -24,9 +24,9 @@ import ydb
from airflow.models.connection import Connection
from airflow.models.dag import DAG
+from airflow.providers.common.compat.sdk import timezone
from airflow.providers.common.sql.hooks.handlers import fetch_all_handler
from airflow.providers.ydb.operators.ydb import YDBExecuteQueryOperator
-from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2024, 1, 1)