leakec commented on issue #50911:
URL: https://github.com/apache/airflow/issues/50911#issuecomment-2901945572

   I tried to re-create this by adding a test in 
`airflow/providers/standard/tests/unit/standard/operators/test_latest_only_operator.py`
 like
   ```python
       def test_regular_latest_only_run(self, run_task):
           """Test latest_only running in normal mode."""
           with DAG(
               "test_dag",
               start_date=datetime.datetime(2024, 12, 11),
               schedule="0 * * * *",
               catchup=False,
           ):
               latest_task = LatestOnlyOperator(task_id="latest")
               downstream_task = EmptyOperator(task_id="downstream")
               latest_task >> downstream_task
   
           run_task(latest_task, run_type=DagRunType.SCHEDULED)
   
           assert run_task.dagrun.data_interval_start != 
run_task.dagrun.data_interval_end
   
           # The task will raise DownstreamTasksSkipped exception if it is not 
the latest run
           assert run_task.state == State.SUCCESS
   ```
   but I could not trigger the same error. For some reason in this case the 
value is passed as an actually `DateTime` rather than a `datetime`. I think 
this is likely something I'm doing incorrectly in setting up the test case, but 
I don't know enough about how airflow testing works to figure out what, if 
anything is different.
   
   I do know that this needs to occur when a schedule is a cron trigger running 
every hour to make it to the portion of `_cron.py` that tries to call 
`in_timezone` on the incoming value. However, for some reason in the test case 
it has the proper type of `DateTime`. 
   
   I'm hoping someone with more knowledge of airflow testing can pick up where 
I left off.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to