This is an automated email from the ASF dual-hosted git repository.
potiuk 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 f25adf14ad Simpler task retrieval for taskinstance test (#41389)
f25adf14ad is described below
commit f25adf14ad486bac818fe3fdcd61eb3355e8ec9b
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Aug 12 08:42:49 2024 +0200
Simpler task retrieval for taskinstance test (#41389)
The test has been updated for DB isolation but the retrieval of
task was not intuitive and it could lead to flaky tests possibly
---
tests/models/test_taskinstance.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/models/test_taskinstance.py
b/tests/models/test_taskinstance.py
index c2993e9ce8..2d3da6a413 100644
--- a/tests/models/test_taskinstance.py
+++ b/tests/models/test_taskinstance.py
@@ -1539,8 +1539,9 @@ class TestTaskInstance:
monkeypatch.setattr(_UpstreamTIStates, "calculate", lambda *_:
upstream_states)
ti = dr.get_task_instance("do_something_else", session=session)
ti.map_index = 0
+ base_task = ti.task
for map_index in range(1, 5):
- ti = TaskInstance(dr.task_instances[-1].task, run_id=dr.run_id,
map_index=map_index)
+ ti = TaskInstance(base_task, run_id=dr.run_id, map_index=map_index)
session.add(ti)
ti.dag_run = dr
session.flush()