diff --git a/tests/providers/amazon/aws/hooks/test_emr.py b/tests/providers/amazon/aws/hooks/test_emr.py index 2489d130afe2e..5cd4a7304e76a 100644 --- a/tests/providers/amazon/aws/hooks/test_emr.py +++ b/tests/providers/amazon/aws/hooks/test_emr.py @@ -18,6 +18,7 @@ from __future__ import annotations import re +import sys import warnings from unittest import mock @@ -171,6 +172,13 @@ def test_create_job_flow_extra_args(self): with warnings.catch_warnings(): # Expected no warnings if ``emr_conn_id`` exists with correct conn_type warnings.simplefilter("error") + if sys.version_info >= (3, 12): + # Ignore some modules' warnings in Python 3.12 + warnings.filterwarnings( + "ignore", + module="botocore.auth", + message=r"datetime.datetime.utcnow\(\) is deprecated*", + ) cluster = hook.create_job_flow({"Name": "test_cluster", "ReleaseLabel": "", "AmiVersion": "3.2"}) cluster = client.describe_cluster(ClusterId=cluster["JobFlowId"])["Cluster"] diff --git a/tests/providers/amazon/conftest.py b/tests/providers/amazon/conftest.py index 4ea7f429bc1e4..eef71f1bb3756 100644 --- a/tests/providers/amazon/conftest.py +++ b/tests/providers/amazon/conftest.py @@ -18,6 +18,7 @@ from __future__ import annotations import os +import sys import warnings try: @@ -59,6 +60,13 @@ def filter_botocore_warnings(botocore_version): module="botocore.client", message="The .* client is currently using a deprecated endpoint.*", ) + if sys.version_info >= (3, 12): + # Ignore some modules' warnings in Python 3.12 + warnings.filterwarnings( + "ignore", + module="botocore.auth", + message=r"datetime.datetime.utcnow\(\) is deprecated*", + ) yield