|
4 | 4 | import inspect |
5 | 5 | import uuid |
6 | 6 | from dataclasses import dataclass, field |
| 7 | +from datetime import timedelta |
7 | 8 | from typing import Any, Literal, Optional, Type |
8 | 9 |
|
9 | | -from temporalio import workflow |
| 10 | +from temporalio import activity, workflow |
10 | 11 | from temporalio.api.common.v1 import Payload |
11 | 12 | from temporalio.client import Client |
12 | 13 | from temporalio.converter import ( |
@@ -47,11 +48,20 @@ class TraceData: |
47 | 48 | items: list[TraceItem] = field(default_factory=list) |
48 | 49 |
|
49 | 50 |
|
| 51 | +@activity.defn |
| 52 | +async def passthrough_activity(input: TraceData) -> TraceData: |
| 53 | + return input |
| 54 | + |
| 55 | + |
50 | 56 | @workflow.defn(sandboxed=False) # we want to use isinstance |
51 | 57 | class SerializationContextTestWorkflow: |
52 | 58 | @workflow.run |
53 | 59 | async def run(self, input: TraceData) -> TraceData: |
54 | | - return input |
| 60 | + return await workflow.execute_activity( |
| 61 | + passthrough_activity, |
| 62 | + input, |
| 63 | + start_to_close_timeout=timedelta(seconds=10), |
| 64 | + ) |
55 | 65 |
|
56 | 66 |
|
57 | 67 | def get_caller_location() -> list[str]: |
@@ -170,7 +180,7 @@ async def test_workflow_payload_conversion_can_be_given_access_to_serialization_ |
170 | 180 | client, |
171 | 181 | task_queue=task_queue, |
172 | 182 | workflows=[SerializationContextTestWorkflow], |
173 | | - activities=[], |
| 183 | + activities=[passthrough_activity], |
174 | 184 | ): |
175 | 185 | result = await client.execute_workflow( |
176 | 186 | SerializationContextTestWorkflow.run, |
|
0 commit comments