7
7
import nexusrpc .handler
8
8
import pytest
9
9
10
+ import temporalio .exceptions
10
11
from temporalio import workflow
11
12
from temporalio .testing import WorkflowEnvironment
12
13
from tests .helpers import new_worker
@@ -38,7 +39,7 @@ async def run(self) -> None:
38
39
await nexus_client .execute_operation (
39
40
Service .op_that_never_returns ,
40
41
None ,
41
- schedule_to_close_timeout = timedelta (seconds = 10 ),
42
+ schedule_to_close_timeout = timedelta (seconds = 1 ),
42
43
)
43
44
44
45
@@ -53,15 +54,11 @@ async def test_nexus_timeout(env: WorkflowEnvironment):
53
54
) as worker :
54
55
await create_nexus_endpoint (worker .task_queue , env .client )
55
56
56
- execute_workflow = env .client .execute_workflow (
57
- NexusCallerWorkflow .run ,
58
- id = str (uuid .uuid4 ()),
59
- task_queue = worker .task_queue ,
60
- )
61
57
try :
62
- await asyncio .wait_for (execute_workflow , timeout = 3 )
63
- except TimeoutError :
64
- print ("Saw expected timeout" )
65
- pass
66
- else :
67
- pytest .fail ("Expected timeout" )
58
+ await env .client .execute_workflow (
59
+ NexusCallerWorkflow .run ,
60
+ id = str (uuid .uuid4 ()),
61
+ task_queue = worker .task_queue ,
62
+ )
63
+ except Exception as err :
64
+ assert err .cause .cause .__class__ == temporalio .exceptions .TimeoutError # type: ignore
0 commit comments