You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ta...@apache.org on 2024/04/09 07:11:02 UTC

(airflow) branch main updated: Resolve core unit test internal warning (#38835)

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 df4ce540bc Resolve core unit test internal warning (#38835)
df4ce540bc is described below

commit df4ce540bcee16214e0c4a2670ee10831ca090c2
Author: Owen Leung <ow...@gmail.com>
AuthorDate: Tue Apr 9 15:10:55 2024 +0800

    Resolve core unit test internal warning (#38835)
    
    * Resolve core unit test internal warning
    
    * add back test_impersonation_subdag into deprecations_ignore.yml
---
 tests/core/test_core.py       | 10 +++++-----
 tests/deprecations_ignore.yml |  2 --
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tests/core/test_core.py b/tests/core/test_core.py
index c687a352bd..2aa54c5e1a 100644
--- a/tests/core/test_core.py
+++ b/tests/core/test_core.py
@@ -136,14 +136,14 @@ class TestCore:
 
         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 @@ class TestCore:
                 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 927d34f527..c88d2b9368 100644
--- a/tests/deprecations_ignore.yml
+++ b/tests/deprecations_ignore.yml
@@ -70,8 +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