Taragolis commented on code in PR #27214: URL: https://github.com/apache/airflow/pull/27214#discussion_r1005742616
########## tests/providers/amazon/conftest.py: ########## @@ -0,0 +1,59 @@ +# 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 + +import warnings + +try: + import importlib_metadata +except ImportError: + from importlib import metadata as importlib_metadata # type: ignore[no-redef] + +import pytest + + [email protected](scope="session") +def botocore_version(): + try: + version = importlib_metadata.version("botocore") + except importlib_metadata.PackageNotFoundError: + warnings.warn("'botocore' package not found'", UserWarning) + return None + + try: + return tuple(map(int, version.split(".")[:3])) + except Exception: + warnings.warn(f"Unable to parse botocore {version!r}", UserWarning) + return None + + [email protected](autouse=True) +def filter_botocore_warnings(botocore_version): + """Filter known botocore future warnings.""" + + with warnings.catch_warnings(): + if botocore_version and botocore_version < (1, 28): + # Deprecate Usage of sslComonName in Endpoint Creation. + # See: https://github.com/boto/botocore/issues/2705 + warnings.filterwarnings( + "ignore", + category=FutureWarning, + module="botocore.client", + message="The .* client is currently using a deprecated endpoint.*", + ) + yield Review Comment: Yeah, seems like even after upgrade to latest minor version of `botocore` and `boto3` it sill use `{region}.{service}.{dnsSuffix}` instead of `{service}.{region}.{dnsSuffix}`, as result this warnings appear in to the test logs. I thought this is fine for regular DAG usage, users would informed that some changes might happen in the future. But what we should do in tests? - Remove fixtures from `conftest.py` and keep this warnings in CI log - Remove upper bound pin to specific botocore version WDYT @potiuk @uranusjr @eladkal In additional I've asked in [botocore issue page](https://github.com/boto/botocore/issues/2705) about default behaviour. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
