You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/01/23 23:59:51 UTC

[airflow] branch main updated: Fix running airflow dags test results in error when run twice (#21031)

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

potiuk 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 515ea84  Fix running airflow dags test <dag_id> <execution_dt> results in error when run twice (#21031)
515ea84 is described below

commit 515ea84335fc440fe022db2a0e3b158e0d7702da
Author: Chenglong Yan <al...@gmail.com>
AuthorDate: Mon Jan 24 07:59:10 2022 +0800

    Fix running airflow dags test <dag_id> <execution_dt> results in error when run twice (#21031)
    
    related: #21023
---
 airflow/cli/commands/dag_command.py    | 2 +-
 tests/cli/commands/test_dag_command.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/airflow/cli/commands/dag_command.py b/airflow/cli/commands/dag_command.py
index 2e537fb..cb18e0c 100644
--- a/airflow/cli/commands/dag_command.py
+++ b/airflow/cli/commands/dag_command.py
@@ -426,7 +426,7 @@ def dag_list_dag_runs(args, dag=None):
 def dag_test(args, session=None):
     """Execute one single DagRun for a given DAG and execution date, using the DebugExecutor."""
     dag = get_dag(subdir=args.subdir, dag_id=args.dag_id)
-    dag.clear(start_date=args.execution_date, end_date=args.execution_date, dag_run_state=State.NONE)
+    dag.clear(start_date=args.execution_date, end_date=args.execution_date, dag_run_state=False)
     try:
         dag.run(
             executor=DebugExecutor(),
diff --git a/tests/cli/commands/test_dag_command.py b/tests/cli/commands/test_dag_command.py
index 097a54d..cea2829 100644
--- a/tests/cli/commands/test_dag_command.py
+++ b/tests/cli/commands/test_dag_command.py
@@ -559,7 +559,7 @@ class TestCliDags(unittest.TestCase):
                 mock.call().clear(
                     start_date=cli_args.execution_date,
                     end_date=cli_args.execution_date,
-                    dag_run_state=State.NONE,
+                    dag_run_state=False,
                 ),
                 mock.call().run(
                     executor=mock_executor.return_value,
@@ -588,7 +588,7 @@ class TestCliDags(unittest.TestCase):
                 mock.call().clear(
                     start_date=cli_args.execution_date,
                     end_date=cli_args.execution_date,
-                    dag_run_state=State.NONE,
+                    dag_run_state=False,
                 ),
                 mock.call().run(
                     executor=mock_executor.return_value,