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

shahar1 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 1b6ff208d30 Test fix in main Celery worker tests leaking logging 
handler onto captured stdout (#69163)
1b6ff208d30 is described below

commit 1b6ff208d300fd0a14dec0eabaa769f2c62a09c7
Author: Anish Giri <[email protected]>
AuthorDate: Tue Jun 30 02:27:02 2026 -0500

    Test fix in main Celery worker tests leaking logging handler onto captured 
stdout (#69163)
---
 providers/celery/tests/unit/celery/cli/test_celery_command.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/providers/celery/tests/unit/celery/cli/test_celery_command.py 
b/providers/celery/tests/unit/celery/cli/test_celery_command.py
index 41332d545cf..1b8b3a07d4c 100644
--- a/providers/celery/tests/unit/celery/cli/test_celery_command.py
+++ b/providers/celery/tests/unit/celery/cli/test_celery_command.py
@@ -45,6 +45,17 @@ from tests_common.test_utils.version_compat import (
 PY313 = sys.version_info >= (3, 13)
 
 
[email protected](autouse=True)
+def _stub_worker_configure_logging():
+    # On Airflow 3.0+, worker() calls the real 
configure_logging(output=sys.stdout.buffer), leaking a
+    # handler onto pytest's captured stdout that raises "I/O operation on 
closed file" in later tests.
+    if not AIRFLOW_V_3_0_PLUS:
+        yield
+        return
+    with mock.patch("airflow.sdk.log.configure_logging"):
+        yield
+
+
 @pytest.fixture(autouse=False)
 def conf_stale_bundle_cleanup_disabled():
     with conf_vars({("dag_processor", "stale_bundle_cleanup_interval"): "0"}):

Reply via email to