Skip to content

Commit

Permalink
Clean up some more warnings in tests (apache#27085)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Oct 18, 2022
1 parent d370362 commit ea55626
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tests/api/common/test_mark_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,11 @@ def _verify_task_instance_states(self, dag, date, state, session=None):

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):
Expand Down Expand Up @@ -748,18 +752,21 @@ def test_set_state_with_multiple_dagruns(self, session=None):
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,
)

Expand Down
13 changes: 12 additions & 1 deletion tests/api_connexion/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit ea55626

Please sign in to comment.