This is an automated email from the ASF dual-hosted git repository.
taragolis 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 7dee832963 Resolve test pool unit test warnings (#38981)
7dee832963 is described below
commit 7dee8329636d8ecdc44c601c58509c51c1017a88
Author: Idan Tepper <[email protected]>
AuthorDate: Sat Apr 13 17:22:02 2024 +0300
Resolve test pool unit test warnings (#38981)
* (test_pool): Removed initialization of task instances with deprecated
executon_date to run_id
* (test_pool): Removed initialization of task instances with deprecated
executon_date to run_id in all tests
---------
Co-authored-by: idantepper <[email protected]>
---
tests/deprecations_ignore.yml | 4 ----
tests/models/test_pool.py | 34 +++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml
index 3c1c8c0efc..b246bb02e0 100644
--- a/tests/deprecations_ignore.yml
+++ b/tests/deprecations_ignore.yml
@@ -164,10 +164,6 @@
- tests/models/test_dagbag.py::TestDagBag::test_load_subdags
- tests/models/test_dagbag.py::TestDagBag::test_skip_cycle_dags
-
tests/models/test_mappedoperator.py::test_expand_mapped_task_instance_with_named_index
-- tests/models/test_pool.py::TestPool::test_default_pool_open_slots
-- tests/models/test_pool.py::TestPool::test_infinite_slots
-- tests/models/test_pool.py::TestPool::test_open_slots
-- tests/models/test_pool.py::TestPool::test_open_slots_including_deferred
-
tests/models/test_skipmixin.py::TestSkipMixin::test_mapped_tasks_skip_all_except
-
tests/models/test_skipmixin.py::TestSkipMixin::test_raise_exception_on_not_accepted_branch_task_ids_type
-
tests/models/test_skipmixin.py::TestSkipMixin::test_raise_exception_on_not_accepted_iterable_branch_task_ids_type
diff --git a/tests/models/test_pool.py b/tests/models/test_pool.py
index a158b35c6f..0e439fa2f3 100644
--- a/tests/models/test_pool.py
+++ b/tests/models/test_pool.py
@@ -74,10 +74,12 @@ class TestPool:
op1 = EmptyOperator(task_id="dummy1", pool="test_pool")
op2 = EmptyOperator(task_id="dummy2", pool="test_pool")
op3 = EmptyOperator(task_id="dummy3", pool="test_pool")
- dag_maker.create_dagrun()
- ti1 = TI(task=op1, execution_date=DEFAULT_DATE)
- ti2 = TI(task=op2, execution_date=DEFAULT_DATE)
- ti3 = TI(task=op3, execution_date=DEFAULT_DATE)
+
+ dr = dag_maker.create_dagrun()
+
+ ti1 = TI(task=op1, run_id=dr.run_id)
+ ti2 = TI(task=op2, run_id=dr.run_id)
+ ti3 = TI(task=op3, run_id=dr.run_id)
ti1.state = State.RUNNING
ti2.state = State.QUEUED
ti3.state = State.DEFERRED
@@ -120,9 +122,11 @@ class TestPool:
):
op1 = EmptyOperator(task_id="dummy1", pool="test_pool")
op2 = EmptyOperator(task_id="dummy2", pool="test_pool")
- dag_maker.create_dagrun()
- ti1 = TI(task=op1, execution_date=DEFAULT_DATE)
- ti2 = TI(task=op2, execution_date=DEFAULT_DATE)
+
+ dr = dag_maker.create_dagrun()
+
+ ti1 = TI(task=op1, run_id=dr.run_id)
+ ti2 = TI(task=op2, run_id=dr.run_id)
ti1.state = State.RUNNING
ti2.state = State.DEFERRED
@@ -162,9 +166,11 @@ class TestPool:
):
op1 = EmptyOperator(task_id="dummy1", pool="test_pool")
op2 = EmptyOperator(task_id="dummy2", pool="test_pool")
- dag_maker.create_dagrun()
- ti1 = TI(task=op1, execution_date=DEFAULT_DATE)
- ti2 = TI(task=op2, execution_date=DEFAULT_DATE)
+
+ dr = dag_maker.create_dagrun()
+
+ ti1 = TI(task=op1, run_id=dr.run_id)
+ ti2 = TI(task=op2, run_id=dr.run_id)
ti1.state = State.RUNNING
ti2.state = State.QUEUED
@@ -205,9 +211,11 @@ class TestPool:
):
op1 = EmptyOperator(task_id="dummy1")
op2 = EmptyOperator(task_id="dummy2", pool_slots=2)
- dag_maker.create_dagrun()
- ti1 = TI(task=op1, execution_date=DEFAULT_DATE)
- ti2 = TI(task=op2, execution_date=DEFAULT_DATE)
+
+ dr = dag_maker.create_dagrun()
+
+ ti1 = TI(task=op1, run_id=dr.run_id)
+ ti2 = TI(task=op2, run_id=dr.run_id)
ti1.state = State.RUNNING
ti2.state = State.QUEUED