Skip to content

Commit 13b8cae

Browse files
committed
Cleanup
1 parent 6b0c5bb commit 13b8cae

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tests/nexus/test_timeout.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,38 @@
1313
from tests.helpers.nexus import create_nexus_endpoint, make_nexus_endpoint_name
1414

1515

16+
@nexusrpc.handler.service_handler
17+
class NexusService:
18+
@nexusrpc.handler.sync_operation
19+
async def op_that_never_returns(
20+
self, _ctx: nexusrpc.handler.StartOperationContext, id: None
21+
) -> None:
22+
await asyncio.Event().wait()
23+
24+
1625
@workflow.defn
1726
class NexusCallerWorkflow:
18-
"""Workflow that calls a Nexus operation."""
19-
2027
@workflow.run
2128
async def run(self) -> None:
2229
nexus_client = workflow.create_nexus_client(
2330
endpoint=make_nexus_endpoint_name(workflow.info().task_queue),
24-
service="MaxConcurrentTestService",
31+
service=NexusService,
2532
)
26-
2733
await nexus_client.execute_operation(
28-
"op", None, schedule_to_close_timeout=timedelta(seconds=60)
34+
NexusService.op_that_never_returns,
35+
None,
36+
schedule_to_close_timeout=timedelta(seconds=10),
2937
)
3038

3139

3240
async def test_nexus_timeout(env: WorkflowEnvironment):
3341
if env.supports_time_skipping:
3442
pytest.skip("Nexus tests don't work with Javas test server")
3543

36-
@nexusrpc.handler.service_handler
37-
class MaxConcurrentTestService:
38-
@nexusrpc.handler.sync_operation
39-
async def op(
40-
self, _ctx: nexusrpc.handler.StartOperationContext, id: None
41-
) -> None:
42-
await asyncio.Event().wait()
43-
4444
async with new_worker(
4545
env.client,
4646
NexusCallerWorkflow,
47-
nexus_service_handlers=[MaxConcurrentTestService()],
47+
nexus_service_handlers=[NexusService()],
4848
) as worker:
4949
await create_nexus_endpoint(worker.task_queue, env.client)
5050

0 commit comments

Comments
 (0)