yuqian90 commented on a change in pull request #8992:
URL: https://github.com/apache/airflow/pull/8992#discussion_r453200860



##########
File path: tests/operators/test_latest_only_operator.py
##########
@@ -47,15 +47,40 @@ def get_task_instances(task_id):
 
 
 class LatestOnlyOperatorTest(unittest.TestCase):
+    @classmethod
+    def setUpClass(cls):
+        from tests.compat import MagicMock
+        from airflow.jobs import SchedulerJob
 
-    def setUp(self):
-        super(LatestOnlyOperatorTest, self).setUp()
-        self.dag = DAG(
+        cls.dag = DAG(

Review comment:
       This fix is needed for the test because the original test calls 
`LatestOnlyOperator.execute()` without first creating a dagrun. Also the 
`create_dag_run` is moved to `setUpClass` so that it's called only once for the 
whole class.




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

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


Reply via email to