From 46236fa70702de1d25253c8972f9843e247ddc7a Mon Sep 17 00:00:00 2001 From: Kengo Seki Date: Wed, 26 Oct 2016 19:47:35 -0700 Subject: [PATCH] [AIRFLOW-586] test_dag_v1 fails from 0 to 3 a.m. dags/test_dag.py tries to set START_DATE to 3 hours before using datetime.replace, but it doesn't support minus value as argument. So we have to use timedelta instead of simple numeric subtraction. Closes #1852 from sekikn/AIRFLOW-586 --- dags/test_dag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dags/test_dag.py b/dags/test_dag.py index 9c506b28d662c..a1cbb74ca0a12 100644 --- a/dags/test_dag.py +++ b/dags/test_dag.py @@ -14,10 +14,10 @@ from airflow import DAG from airflow.operators.dummy_operator import DummyOperator -from datetime import datetime +from datetime import datetime, timedelta now = datetime.now() -now_to_the_hour = now.replace(hour=now.time().hour-3 , minute=0, second=0, microsecond=0) +now_to_the_hour = (now - timedelta(0, 0, 0, 0, 0, 3)).replace(minute=0, second=0, microsecond=0) START_DATE = now_to_the_hour DAG_NAME = 'test_dag_v1'