o-nikolas commented on code in PR #40285: URL: https://github.com/apache/airflow/pull/40285#discussion_r1644786444
########## tests/jobs/test_backfill_job.py: ########## @@ -694,20 +712,21 @@ def test_backfill_run_rescheduled(self, dag_maker): ti.refresh_from_db() ti.set_state(State.UP_FOR_RESCHEDULE) - job = Job(executor=executor) - job_runner = BackfillJobRunner( - job=job, - dag=dag, - start_date=DEFAULT_DATE, - end_date=DEFAULT_DATE + datetime.timedelta(days=2), - rerun_failed_tasks=True, - ) - run_job(job=job, execute_callable=job_runner._execute) - ti = TI(task=dag.get_task("test_backfill_run_rescheduled_task-1"), run_id=DEFAULT_DAG_RUN_ID) - ti.refresh_from_db() - assert ti.state == State.SUCCESS + for _ in self._mock_executor(): Review Comment: This is a neat bit of syntax that is using `_mock_executor()` as a generator since it cannot be used as a context manager (i.e. with `with`) because the object that is yielded (the MockExecutor) does not implement `__aexit__` or `__aexit__`, you will get an exception if you try. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org