1616# under the License.
1717from __future__ import annotations
1818
19- from datetime import datetime , timedelta
19+ from datetime import datetime
2020
2121import pytest
2222
3030from airflow .providers .standard .operators .bash import BashOperator
3131from airflow .utils import timezone
3232from airflow .utils .state import State
33- from airflow .utils .types import DagRunType
3433
3534pytestmark = pytest .mark .db_test
3635
@@ -93,6 +92,7 @@ def test_taskcallback_to_json_with_start_date_and_end_date(self, session, create
9392 result = TaskCallbackRequest .from_json (json_str )
9493 assert input == result
9594
95+ @pytest .mark .xfail (reason = "AIP-72 -- port this _sort_ of test to TaskSDK runtime context" )
9696 def test_simple_ti_roundtrip_exec_config_pod (self ):
9797 """A callback request including a TI with an exec config with a V1Pod should safely roundtrip."""
9898 from kubernetes .client import models as k8s
@@ -107,24 +107,3 @@ def test_simple_ti_roundtrip_exec_config_pod(self):
107107 data = TaskCallbackRequest (full_filepath = "hi" , ti = ti ).to_json ()
108108 actual = TaskCallbackRequest .from_json (data ).ti .executor_config ["pod_override" ]
109109 assert actual == test_pod
110-
111- def test_simple_ti_roundtrip_dates (self , dag_maker ):
112- """A callback request including a TI with an exec config with a V1Pod should safely roundtrip."""
113- from airflow .callbacks .callback_requests import TaskCallbackRequest
114- from airflow .models import TaskInstance
115- from airflow .providers .standard .operators .bash import BashOperator
116-
117- with dag_maker (schedule = timedelta (weeks = 1 ), serialized = True ):
118- op = BashOperator (task_id = "hi" , bash_command = "hi" )
119- dr = dag_maker .create_dagrun (
120- run_type = DagRunType .SCHEDULED ,
121- external_trigger = True ,
122- )
123- ti = TaskInstance (task = op , run_id = dr .run_id )
124- ti .refresh_from_db ()
125- ti .set_state ("SUCCESS" )
126- start_date = ti .start_date
127- end_date = ti .end_date
128- data = TaskCallbackRequest (full_filepath = "hi" , ti = ti ).to_json ()
129- assert TaskCallbackRequest .from_json (data ).ti .start_date == start_date
130- assert TaskCallbackRequest .from_json (data ).ti .end_date == end_date
0 commit comments