uranusjr commented on a change in pull request #21261:
URL: https://github.com/apache/airflow/pull/21261#discussion_r798294080



##########
File path: tests/providers/elasticsearch/log/test_es_task_handler.py
##########
@@ -38,6 +39,19 @@
 from .elasticmock import elasticmock
 
 
+def get_ti(dag_id, task_id, execution_date, create_task_instance):
+    ti = create_task_instance(
+        dag_id=dag_id,
+        task_id=task_id,
+        execution_date=execution_date,
+        dagrun_state=DagRunState.RUNNING,
+        state=TaskInstanceState.RUNNING,
+    )
+    ti.try_number = 1
+    ti.raw = False
+    return ti

Review comment:
       How about turning this into a fixture?
   
   ```python
   @pytest.fixture()
   def create_running_task_instance(create_task_instance):
       def _create_ti(**kwargs):
           ti = create_task_instance(
               dagrun_state=DagRunState.RUNNING,
               state=TaskInstanceState.RUNNING,
               **kwargs,
           )
           ti.try_number = 1
           ti.raw = False
           return ti
   
       return _create_ti
   ```




-- 
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