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

dabla 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 48ccf8119b5 Fix unexpected stdout output in async S3Hook decorator 
(#76855)
48ccf8119b5 is described below

commit 48ccf8119b59cb940f9bb9d5b8a7bab4b75749c8
Author: FNU Aditya Ranjan <[email protected]>
AuthorDate: Wed Nov 11 03:00:28 2026 -0600

    Fix unexpected stdout output in async S3Hook decorator (#76855)
    
    * Fix unexpected stdout output in async S3Hook decorator
---
 .../amazon/src/airflow/providers/amazon/aws/hooks/s3.py     |  1 -
 providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py     | 13 +++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py 
b/providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py
index 53ef3cd3805..3e5843b8fe8 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py
@@ -101,7 +101,6 @@ def provide_bucket_name(func: Callable) -> Callable:
         @wraps(func)
         async def wrapper(*args: Any, **kwargs: Any) -> Any:
             bound_args = await maybe_add_bucket_name(*args, **kwargs)
-            print(f"invoking async function {func=}")
             return await func(*bound_args.args, **bound_args.kwargs)
 
     elif inspect.isasyncgenfunction(func):
diff --git a/providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py 
b/providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py
index 5a4d4d9fe63..ca106a95b99 100644
--- a/providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py
+++ b/providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py
@@ -678,6 +678,19 @@ class TestAwsS3Hook:
             **extra_params,
         )
 
+    @pytest.mark.asyncio
+    async def test_get_head_object_async_does_not_print_to_stdout(self, 
capsys):
+        """Async S3 calls must not emit debug output to stdout."""
+        hook = S3Hook(aws_conn_id=None)
+        client = AsyncMock(spec=["head_object"])
+        client.head_object = AsyncMock(return_value={"ContentLength": 10})
+
+        result = await hook.get_head_object_async(client, "test-key", 
"test-bucket")
+
+        assert result == {"ContentLength": 10}
+        client.head_object.assert_awaited_once_with(Bucket="test-bucket", 
Key="test-key")
+        assert capsys.readouterr().out == ""
+
     @pytest.mark.asyncio
     async def test_s3_key_hook_get_head_object_with_error_async(self):
         """

Reply via email to