amoghrajesh commented on code in PR #66160:
URL: https://github.com/apache/airflow/pull/66160#discussion_r3186893227
##########
task-sdk/tests/task_sdk/execution_time/test_context.py:
##########
@@ -1032,3 +1053,242 @@ def get_connection(self, conn_id):
with pytest.raises(AirflowNotFoundException, match="isn't
defined"):
_get_connection("nonexistent_conn")
+
+
+class TestTaskStateAccessor:
+ TI_ID = UUID("01900000-0000-0000-0000-000000000001")
+
+ def test_get_returns_value(self, mock_supervisor_comms):
+ mock_supervisor_comms.send.return_value =
TaskStateResult(value="app_001")
+
+ result = TaskStateAccessor(ti_id=self.TI_ID).get("job_id")
+
+ assert result == "app_001"
+
mock_supervisor_comms.send.assert_called_once_with(GetTaskState(ti_id=self.TI_ID,
key="job_id"))
Review Comment:
Keeping `assert_called_once_with` — these tests intentionally verify a
single call and the current form is idiomatic for that. `mock_calls ==
[call(...)]` would be useful if we needed to assert an exact sequence.
--
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]