Skip to content

Commit 095e228

Browse files
committed
Test activity
1 parent 4f0026b commit 095e228

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/test_serialization_context.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import inspect
55
import uuid
66
from dataclasses import dataclass, field
7+
from datetime import timedelta
78
from typing import Any, Literal, Optional, Type
89

9-
from temporalio import workflow
10+
from temporalio import activity, workflow
1011
from temporalio.api.common.v1 import Payload
1112
from temporalio.client import Client
1213
from temporalio.converter import (
@@ -47,11 +48,20 @@ class TraceData:
4748
items: list[TraceItem] = field(default_factory=list)
4849

4950

51+
@activity.defn
52+
async def passthrough_activity(input: TraceData) -> TraceData:
53+
return input
54+
55+
5056
@workflow.defn(sandboxed=False) # we want to use isinstance
5157
class SerializationContextTestWorkflow:
5258
@workflow.run
5359
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+
)
5565

5666

5767
def get_caller_location() -> list[str]:
@@ -170,7 +180,7 @@ async def test_workflow_payload_conversion_can_be_given_access_to_serialization_
170180
client,
171181
task_queue=task_queue,
172182
workflows=[SerializationContextTestWorkflow],
173-
activities=[],
183+
activities=[passthrough_activity],
174184
):
175185
result = await client.execute_workflow(
176186
SerializationContextTestWorkflow.run,

0 commit comments

Comments
 (0)