From a8f9bc98eb9e10eb94d1afc716940755e6f86fe6 Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Mon, 8 Apr 2024 20:27:32 +0800 Subject: [PATCH 1/2] Resolve core unit test internal warning --- tests/core/test_core.py | 10 +++++----- tests/deprecations_ignore.yml | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/core/test_core.py b/tests/core/test_core.py index c687a352bd636..2aa54c5e1aae6 100644 --- a/tests/core/test_core.py +++ b/tests/core/test_core.py @@ -136,14 +136,14 @@ def test_externally_triggered_dagrun(self, dag_maker): with dag_maker(schedule=timedelta(weeks=1)): task = EmptyOperator(task_id="test_externally_triggered_dag_context") - dag_maker.create_dagrun( + dr = dag_maker.create_dagrun( run_type=DagRunType.SCHEDULED, execution_date=execution_date, external_trigger=True, ) task.run(start_date=execution_date, end_date=execution_date) - ti = TI(task=task, execution_date=execution_date) + ti = TI(task=task, run_id=dr.run_id) context = ti.get_template_context() # next_ds should be the execution date for manually triggered runs @@ -169,14 +169,14 @@ def test_dag_params_and_task_params(self, dag_maker): params={"key_2": "value_2_new", "key_3": "value_3"}, ) task2 = EmptyOperator(task_id="task2") - dag_maker.create_dagrun( + dr = dag_maker.create_dagrun( run_type=DagRunType.SCHEDULED, external_trigger=True, ) task1.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) task2.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) - ti1 = TI(task=task1, execution_date=DEFAULT_DATE) - ti2 = TI(task=task2, execution_date=DEFAULT_DATE) + ti1 = TI(task=task1, run_id=dr.run_id) + ti2 = TI(task=task2, run_id=dr.run_id) context1 = ti1.get_template_context() context2 = ti2.get_template_context() diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml index 927d34f5278bd..38a744f34e03d 100644 --- a/tests/deprecations_ignore.yml +++ b/tests/deprecations_ignore.yml @@ -70,9 +70,6 @@ # Core -- tests/core/test_core.py::TestCore::test_dag_params_and_task_params -- tests/core/test_core.py::TestCore::test_externally_triggered_dagrun -- tests/core/test_impersonation_tests.py::TestImpersonation::test_impersonation_subdag - tests/core/test_stats.py::TestCustomStatsName::test_does_not_send_stats_using_statsd_when_the_name_is_not_valid - tests/core/test_stats.py::TestCustomStatsName::test_does_send_stats_using_statsd_when_the_name_is_valid - tests/core/test_stats.py::TestPatternOrBasicValidatorConfigOption::test_pattern_or_basic_picker From 3be79efd02f0a261ac3a7434d13b7bbf719fb424 Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Mon, 8 Apr 2024 21:24:24 +0800 Subject: [PATCH 2/2] add back test_impersonation_subdag into deprecations_ignore.yml --- tests/deprecations_ignore.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml index 38a744f34e03d..c88d2b9368cb2 100644 --- a/tests/deprecations_ignore.yml +++ b/tests/deprecations_ignore.yml @@ -70,6 +70,7 @@ # Core +- tests/core/test_impersonation_tests.py::TestImpersonation::test_impersonation_subdag - tests/core/test_stats.py::TestCustomStatsName::test_does_not_send_stats_using_statsd_when_the_name_is_not_valid - tests/core/test_stats.py::TestCustomStatsName::test_does_send_stats_using_statsd_when_the_name_is_valid - tests/core/test_stats.py::TestPatternOrBasicValidatorConfigOption::test_pattern_or_basic_picker