Skip to content

Commit bfea145

Browse files
andystaplesCopilot
andcommitted
Assert that never-awaited operations in teardown tests are unstarted
Co-authored-by: Copilot App <[email protected]>
1 parent e9637c0 commit bfea145

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎tests/durabletask/test_async_context.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@ def test_unused_cold_operation_is_closed_without_warning(monkeypatch: pytest.Mon
680680

681681
async def orchestrator(ctx: task.AsyncOrchestrationContext, _: Any) -> str:
682682
# Created and kept in a local, but never awaited: teardown must close it.
683-
_pending = ctx.call_activity("never-started") # noqa: F841
683+
pending = ctx.call_activity("never-started")
684+
assert inspect.getcoroutinestate(pending) == inspect.CORO_CREATED
684685
return "done"
685686

686687
result = _execute(orchestrator, [], _start())
@@ -704,7 +705,8 @@ def __del__(self) -> None:
704705

705706
async def orchestrator(ctx: task.AsyncOrchestrationContext, _: Any) -> None:
706707
# Created and kept in a local, but never awaited: teardown must close it.
707-
_pending = ctx.call_activity("work", input=Probe()) # noqa: F841
708+
pending = ctx.call_activity("work", input=Probe())
709+
assert inspect.getcoroutinestate(pending) == inspect.CORO_CREATED
708710
await ctx.wait_for_external_event("never")
709711

710712
async def host() -> None:

0 commit comments

Comments
 (0)