File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import uuid
2+
3+ from temporalio import activity
4+ from temporalio .testing import WorkflowEnvironment
5+ from temporalio .worker import Worker
6+
7+ from custom_metric .worker import ExecuteActivityWorkflow
8+
9+ _TASK_QUEUE = "custom-metric-task-queue"
10+
11+ activity_counter = 0
12+
13+
14+ async def test_sleep_for_days_workflow ():
15+
16+ @activity .defn (name = "print_message" )
17+ async def print_message_mock ():
18+ global activity_counter
19+ activity_counter += 1
20+
21+ async with await WorkflowEnvironment .start_time_skipping () as env :
22+
23+ async with Worker (
24+ env .client ,
25+ task_queue = _TASK_QUEUE ,
26+ workflows = [ExecuteActivityWorkflow ],
27+ activities = [print_message_mock ],
28+ ):
29+ result = await env .client .execute_workflow (
30+ ExecuteActivityWorkflow .run ,
31+ id = str (uuid .uuid4 ()),
32+ task_queue = _TASK_QUEUE ,
33+ )
34+ assert result is None
35+ assert activity_counter == 2
You can’t perform that action at this time.
0 commit comments