77import nexusrpc .handler
88import pytest
99
10+ import temporalio .exceptions
1011from temporalio import workflow
1112from temporalio .testing import WorkflowEnvironment
1213from tests .helpers import new_worker
@@ -38,13 +39,13 @@ async def run(self) -> None:
3839 await nexus_client .execute_operation (
3940 Service .op_that_never_returns ,
4041 None ,
41- schedule_to_close_timeout = timedelta (seconds = 10 ),
42+ schedule_to_close_timeout = timedelta (seconds = 1 ),
4243 )
4344
4445
4546async def test_nexus_timeout (env : WorkflowEnvironment ):
4647 if env .supports_time_skipping :
47- pytest .skip ("Nexus tests don't work with Javas test server" )
48+ pytest .skip ("Nexus tests don't work with Java test server" )
4849
4950 async with new_worker (
5051 env .client ,
@@ -53,15 +54,11 @@ async def test_nexus_timeout(env: WorkflowEnvironment):
5354 ) as worker :
5455 await create_nexus_endpoint (worker .task_queue , env .client )
5556
56- execute_workflow = env .client .execute_workflow (
57- NexusCallerWorkflow .run ,
58- id = str (uuid .uuid4 ()),
59- task_queue = worker .task_queue ,
60- )
6157 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