ashb commented on a change in pull request #17425:
URL: https://github.com/apache/airflow/pull/17425#discussion_r683338533



##########
File path: tests/models/test_taskinstance.py
##########
@@ -437,75 +442,51 @@ def create_task_instance():
             create_task_instance()
 
     @provide_session
-    def test_ti_updates_with_task(self, session=None):
+    def test_ti_updates_with_task(self, get_dummy_dag, session=None):
         """
         test that updating the executor_config propagates to the TaskInstance 
DB
         """
-        with models.DAG(dag_id='test_run_pooling_task') as dag:
-            task = DummyOperator(
-                task_id='test_run_pooling_task_op',
-                owner='airflow',
-                executor_config={'foo': 'bar'},
-                start_date=timezone.datetime(2016, 2, 1, 0, 0, 0),
-            )
-        ti = TI(task=task, execution_date=timezone.utcnow())
-
-        dag.create_dagrun(
-            execution_date=ti.execution_date,
-            state=State.RUNNING,
-            run_type=DagRunType.SCHEDULED,
-            session=session,
+        dag, task = get_dummy_dag(
+            dag_id='test_run_pooling_task',
+            task_id='test_run_pooling_task_op',
+            executor_config={'foo': 'bar'},
         )
+        ti = TI(task=task, execution_date=timezone.utcnow())
 
         ti.run(session=session)
         tis = dag.get_task_instances()
         assert {'foo': 'bar'} == tis[0].executor_config
-        with models.DAG(dag_id='test_run_pooling_task') as dag:
-            task2 = DummyOperator(
-                task_id='test_run_pooling_task_op',
-                owner='airflow',
-                executor_config={'bar': 'baz'},
-                start_date=timezone.datetime(2016, 2, 1, 0, 0, 0),
-            )
+        task2 = DummyOperator(
+            task_id='test_run_pooling_task_op2',
+            owner='airflow',

Review comment:
       ```suggestion
   ```
   
   Let's remove these -- it's not relevant to the any of these test I think.

##########
File path: tests/models/test_taskinstance.py
##########
@@ -437,75 +442,51 @@ def create_task_instance():
             create_task_instance()
 
     @provide_session
-    def test_ti_updates_with_task(self, session=None):
+    def test_ti_updates_with_task(self, get_dummy_dag, session=None):
         """
         test that updating the executor_config propagates to the TaskInstance 
DB
         """
-        with models.DAG(dag_id='test_run_pooling_task') as dag:
-            task = DummyOperator(
-                task_id='test_run_pooling_task_op',
-                owner='airflow',
-                executor_config={'foo': 'bar'},
-                start_date=timezone.datetime(2016, 2, 1, 0, 0, 0),
-            )
-        ti = TI(task=task, execution_date=timezone.utcnow())
-
-        dag.create_dagrun(
-            execution_date=ti.execution_date,
-            state=State.RUNNING,
-            run_type=DagRunType.SCHEDULED,
-            session=session,
+        dag, task = get_dummy_dag(
+            dag_id='test_run_pooling_task',
+            task_id='test_run_pooling_task_op',
+            executor_config={'foo': 'bar'},
         )
+        ti = TI(task=task, execution_date=timezone.utcnow())
 
         ti.run(session=session)
         tis = dag.get_task_instances()
         assert {'foo': 'bar'} == tis[0].executor_config
-        with models.DAG(dag_id='test_run_pooling_task') as dag:
-            task2 = DummyOperator(
-                task_id='test_run_pooling_task_op',
-                owner='airflow',
-                executor_config={'bar': 'baz'},
-                start_date=timezone.datetime(2016, 2, 1, 0, 0, 0),
-            )
+        task2 = DummyOperator(
+            task_id='test_run_pooling_task_op2',
+            owner='airflow',

Review comment:
       Looks like you already did get rid of all the others :+1:




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


Reply via email to