@@ -53,13 +53,18 @@ def sample_decision_task(self):
5353 task .workflow_execution .run_id = "test_run_id"
5454 task .workflow_type = Mock ()
5555 task .workflow_type .name = "TestWorkflow"
56+ # Add the missing attributes that are now accessed directly
57+ task .started_event_id = 1
58+ task .attempt = 1
5659 return task
5760
5861 @pytest .mark .asyncio
5962 async def test_full_task_handling_flow_success (self , handler , sample_decision_task , mock_registry ):
6063 """Test the complete task handling flow from base handler through decision handler."""
6164 # Mock workflow function
62- mock_workflow_func = Mock ()
65+ def mock_workflow_func (input_data ):
66+ return f"processed: { input_data } "
67+
6368 mock_registry .get_workflow .return_value = mock_workflow_func
6469
6570 # Mock workflow engine
@@ -81,7 +86,9 @@ async def test_full_task_handling_flow_success(self, handler, sample_decision_ta
8186 async def test_full_task_handling_flow_with_error (self , handler , sample_decision_task , mock_registry ):
8287 """Test the complete task handling flow when an error occurs."""
8388 # Mock workflow function
84- mock_workflow_func = Mock ()
89+ def mock_workflow_func (input_data ):
90+ return f"processed: { input_data } "
91+
8592 mock_registry .get_workflow .return_value = mock_workflow_func
8693
8794 # Mock workflow engine to raise an error
@@ -102,7 +109,9 @@ async def test_full_task_handling_flow_with_error(self, handler, sample_decision
102109 async def test_context_activation_integration (self , handler , sample_decision_task , mock_registry ):
103110 """Test that context activation works correctly in the integration."""
104111 # Mock workflow function
105- mock_workflow_func = Mock ()
112+ def mock_workflow_func (input_data ):
113+ return f"processed: { input_data } "
114+
106115 mock_registry .get_workflow .return_value = mock_workflow_func
107116
108117 # Mock workflow engine
@@ -133,7 +142,9 @@ def track_context_activation():
133142 async def test_multiple_workflow_executions (self , handler , mock_registry ):
134143 """Test handling multiple workflow executions creates new engines for each."""
135144 # Mock workflow function
136- mock_workflow_func = Mock ()
145+ def mock_workflow_func (input_data ):
146+ return f"processed: { input_data } "
147+
137148 mock_registry .get_workflow .return_value = mock_workflow_func
138149
139150 # Create multiple decision tasks for different workflows
@@ -144,6 +155,8 @@ async def test_multiple_workflow_executions(self, handler, mock_registry):
144155 task1 .workflow_execution .run_id = "run1"
145156 task1 .workflow_type = Mock ()
146157 task1 .workflow_type .name = "TestWorkflow"
158+ task1 .started_event_id = 1
159+ task1 .attempt = 1
147160
148161 task2 = Mock (spec = PollForDecisionTaskResponse )
149162 task2 .task_token = b"task2_token"
@@ -152,6 +165,8 @@ async def test_multiple_workflow_executions(self, handler, mock_registry):
152165 task2 .workflow_execution .run_id = "run2"
153166 task2 .workflow_type = Mock ()
154167 task2 .workflow_type .name = "TestWorkflow"
168+ task2 .started_event_id = 2
169+ task2 .attempt = 1
155170
156171 # Mock workflow engine
157172 mock_engine = Mock (spec = WorkflowEngine )
@@ -176,7 +191,9 @@ async def test_multiple_workflow_executions(self, handler, mock_registry):
176191 async def test_workflow_engine_creation_integration (self , handler , sample_decision_task , mock_registry ):
177192 """Test workflow engine creation integration."""
178193 # Mock workflow function
179- mock_workflow_func = Mock ()
194+ def mock_workflow_func (input_data ):
195+ return f"processed: { input_data } "
196+
180197 mock_registry .get_workflow .return_value = mock_workflow_func
181198
182199 # Mock workflow engine
@@ -197,7 +214,9 @@ async def test_workflow_engine_creation_integration(self, handler, sample_decisi
197214 async def test_error_handling_with_context_cleanup (self , handler , sample_decision_task , mock_registry ):
198215 """Test that context cleanup happens even when errors occur."""
199216 # Mock workflow function
200- mock_workflow_func = Mock ()
217+ def mock_workflow_func (input_data ):
218+ return f"processed: { input_data } "
219+
201220 mock_registry .get_workflow .return_value = mock_workflow_func
202221
203222 # Mock workflow engine to raise an error
@@ -231,7 +250,9 @@ async def test_concurrent_task_handling(self, handler, mock_registry):
231250 import asyncio
232251
233252 # Mock workflow function
234- mock_workflow_func = Mock ()
253+ def mock_workflow_func (input_data ):
254+ return f"processed: { input_data } "
255+
235256 mock_registry .get_workflow .return_value = mock_workflow_func
236257
237258 # Create multiple tasks
@@ -244,6 +265,8 @@ async def test_concurrent_task_handling(self, handler, mock_registry):
244265 task .workflow_execution .run_id = f"run{ i } "
245266 task .workflow_type = Mock ()
246267 task .workflow_type .name = "TestWorkflow"
268+ task .started_event_id = i + 1
269+ task .attempt = 1
247270 tasks .append (task )
248271
249272 # Mock workflow engine
0 commit comments