Skip to content

Commit ecd975c

Browse files
committed
Cleanup
1 parent b7aaff7 commit ecd975c

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/nexus/test_timeout.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import nexusrpc.handler
88
import pytest
99

10+
import temporalio.exceptions
1011
from temporalio import workflow
1112
from temporalio.testing import WorkflowEnvironment
1213
from tests.helpers import new_worker
@@ -38,7 +39,7 @@ 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

@@ -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

Comments
 (0)