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

ashb 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 21c522c515e Fix leaking state in task-sdk test_task_runner.py's tests 
(#74606)
21c522c515e is described below

commit 21c522c515ee20d83f58a8c037f8e14f4d423be4
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Mon Oct 12 19:09:22 2026 +0100

    Fix leaking state in task-sdk test_task_runner.py's tests (#74606)
    
    If you happend to run execution_time/test_task_runner.py
    execution_time/test_supervisor.py in the order, at the same time it would 
fail
    logging related tests on test_supervisor as the structlog context got left
---
 task-sdk/tests/task_sdk/execution_time/test_task_runner.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/task-sdk/tests/task_sdk/execution_time/test_task_runner.py 
b/task-sdk/tests/task_sdk/execution_time/test_task_runner.py
index 2cd63cce594..af2a15dca34 100644
--- a/task-sdk/tests/task_sdk/execution_time/test_task_runner.py
+++ b/task-sdk/tests/task_sdk/execution_time/test_task_runner.py
@@ -213,6 +213,13 @@ if TYPE_CHECKING:
 import time_machine
 
 
[email protected](autouse=True)
+def _clear_structlog_contextvars():
+    # startup() binds TI identifiers for the life of the worker process; we 
need to clear them else other tests will be impacted.
+    yield
+    structlog.contextvars.clear_contextvars()
+
+
 def get_inline_dag(dag_id: str, task: BaseOperator) -> DAG:
     """Creates an inline dag and returns it based on dag_id and task."""
     dag = DAG(dag_id=dag_id, start_date=timezone.datetime(2024, 12, 3))

Reply via email to