Skip to content

Commit

Permalink
Fix running airflow dags test <dag_id> <execution_dt> results in erro…
Browse files Browse the repository at this point in the history
…r when run twice (#21031)

related: #21023
(cherry picked from commit 515ea84)
  • Loading branch information
chenglongyan authored and potiuk committed Jan 23, 2022
1 parent a81e323 commit 8edcf10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion airflow/cli/commands/dag_command.py
Expand Up @@ -406,7 +406,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(),
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/commands/test_dag_command.py
Expand Up @@ -517,7 +517,7 @@ def test_dag_test(self, mock_get_dag, mock_executor):
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,
Expand Down Expand Up @@ -548,7 +548,7 @@ def test_dag_test_show_dag(self, mock_get_dag, mock_executor, mock_render_dag):
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,
Expand Down

0 comments on commit 8edcf10

Please sign in to comment.