You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ur...@apache.org on 2022/10/18 02:45:11 UTC

[airflow] branch main updated: Clean up some more warnings in tests (#27085)

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

uranusjr 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 ea55626d79 Clean up some more warnings in tests (#27085)
ea55626d79 is described below

commit ea55626d79fdbd96b6d5f371883ac1df2a6313ec
Author: Tzu-ping Chung <ur...@gmail.com>
AuthorDate: Tue Oct 18 10:45:03 2022 +0800

    Clean up some more warnings in tests (#27085)
---
 tests/api/common/test_mark_tasks.py |  9 ++++++++-
 tests/api_connexion/conftest.py     | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/tests/api/common/test_mark_tasks.py b/tests/api/common/test_mark_tasks.py
index b2de0a4de1..152ca353ea 100644
--- a/tests/api/common/test_mark_tasks.py
+++ b/tests/api/common/test_mark_tasks.py
@@ -540,7 +540,11 @@ class TestMarkDAGRun:
 
     def _create_test_dag_run(self, state, date):
         return self.dag1.create_dagrun(
-            run_type=DagRunType.MANUAL, state=state, start_date=date, execution_date=date
+            run_type=DagRunType.MANUAL,
+            state=state,
+            start_date=date,
+            execution_date=date,
+            data_interval=(date, date),
         )
 
     def _verify_dag_run_state(self, dag, date, state):
@@ -748,18 +752,21 @@ class TestMarkDAGRun:
             run_type=DagRunType.MANUAL,
             state=State.FAILED,
             execution_date=self.execution_dates[0],
+            data_interval=(self.execution_dates[0], self.execution_dates[0]),
             session=session,
         )
         dr2 = self.dag2.create_dagrun(
             run_type=DagRunType.MANUAL,
             state=State.FAILED,
             execution_date=self.execution_dates[1],
+            data_interval=(self.execution_dates[1], self.execution_dates[1]),
             session=session,
         )
         self.dag2.create_dagrun(
             run_type=DagRunType.MANUAL,
             state=State.RUNNING,
             execution_date=self.execution_dates[2],
+            data_interval=(self.execution_dates[2], self.execution_dates[2]),
             session=session,
         )
 
diff --git a/tests/api_connexion/conftest.py b/tests/api_connexion/conftest.py
index bc5ff88747..bf2fa2af56 100644
--- a/tests/api_connexion/conftest.py
+++ b/tests/api_connexion/conftest.py
@@ -16,8 +16,11 @@
 # under the License.
 from __future__ import annotations
 
+import warnings
+
 import pytest
 
+from airflow.exceptions import RemovedInAirflow3Warning
 from airflow.www import app
 from tests.test_utils.config import conf_vars
 from tests.test_utils.decorators import dont_initialize_flask_app_submodules
@@ -52,5 +55,13 @@ def session():
 def dagbag():
     from airflow.models import DagBag
 
-    DagBag(include_examples=True, read_dags_from_db=False).sync_to_db()
+    with warnings.catch_warnings():
+        # This explicitly shows off SubDagOperator, no point to warn about that.
+        warnings.filterwarnings(
+            "ignore",
+            category=RemovedInAirflow3Warning,
+            message=r".+Please use.+TaskGroup.+",
+            module=r".+example_subdag_operator$",
+        )
+        DagBag(include_examples=True, read_dags_from_db=False).sync_to_db()
     return DagBag(include_examples=True, read_dags_from_db=True)