uranusjr commented on code in PR #24530:
URL: https://github.com/apache/airflow/pull/24530#discussion_r922955823


##########
tests/test_utils/mock_operators.py:
##########
@@ -161,3 +161,17 @@ def __init__(self, **kwargs):
 
     def execute(self, context: Context):
         pass
+
+
+class XCOMPushOperator(BaseOperator):
+    """
+    Operator which pushes an extra XCOM value along with the default 
XCOM_RETURN_KEY
+    """
+
+    def __init__(self, return_value, **kwargs):
+        super().__init__(do_xcom_push=True, **kwargs)
+        self.return_value = return_value
+
+    def execute(self, context: Context):
+        context['task_instance'].xcom_push(key='extra_key', 
value="extra_value")
+        return self.return_value

Review Comment:
   Since there’s only one test that needs this class, I’d put it in the test 
instead.



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