You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/25 13:41:16 UTC

[GitHub] [airflow] ashb commented on a change in pull request #19825: Deprecate passing execution_date to XCom methods

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



##########
File path: tests/models/test_xcom.py
##########
@@ -217,24 +216,24 @@ def test_xcom_init_on_load_uses_orm_deserialize_value(self, mock_orm_deserialize
         mock_orm_deserialize.assert_called_once_with()
 
     @conf_vars({("core", "xcom_backend"): "tests.models.test_xcom.CustomXCom"})
-    def test_get_one_doesnt_use_orm_deserialize_value(self, session):
+    def test_get_one_doesnt_use_orm_deserialize_value(self, dag_run, session):
         """Test that XCom.get_one does not call orm_deserialize_value"""
         json_obj = {"key": "value"}
-        execution_date = timezone.utcnow()
-        key = XCOM_RETURN_KEY
-        dag_id = "test_dag"
         task_id = "test_task"
 
         XCom = resolve_xcom_backend()
         XCom.set(
-            key=key,
+            key=XCOM_RETURN_KEY,
             value=json_obj,
-            dag_id=dag_id,
+            dag_id=dag_run.dag_id,
             task_id=task_id,
-            execution_date=execution_date,
+            run_id=dag_run.run_id,
             session=session,
         )
 
-        value = XCom.get_one(dag_id=dag_id, task_id=task_id, execution_date=execution_date, session=session)
+        value = XCom.get_one(dag_id=dag_run.dag_id, task_id=task_id, run_id=dag_run.run_id, session=session)
 
         assert value == json_obj
+
+
+# TODO: Add a test of `include_prior_dates` at all! And when given a run_id or a execution_date

Review comment:
       Not finished yet :)




-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org