@@ -5584,18 +5584,18 @@ class _UnfinishedHandlersOnWorkflowTerminationTest:
55845584 async def test_warning_is_issued_on_exit_with_unfinished_handler (
55855585 self ,
55865586 ):
5587- warnings_emitted = await self ._run_workflow_and_get_warning ()
5587+ warning_emitted = await self ._run_workflow_and_get_warning ()
55885588 if self .workflow_termination_type == "-cancellation-" :
55895589 # All paths through this test for which the workflow is cancelled result
55905590 # in the warning being emitted.
5591- assert warnings_emitted == 1
5591+ assert warning_emitted
55925592 else :
55935593 # Otherwise, the warning is emitted iff the workflow does not wait for handlers to finish.
5594- assert warnings_emitted == (
5595- 1 if self .handler_waiting == "-no-wait-all-handlers-finish-" else 0
5594+ assert warning_emitted == (
5595+ self .handler_waiting == "-no-wait-all-handlers-finish-"
55965596 )
55975597
5598- async def _run_workflow_and_get_warning (self ) -> int :
5598+ async def _run_workflow_and_get_warning (self ) -> bool :
55995599 workflow_id = f"wf-{ uuid .uuid4 ()} "
56005600 update_id = "update-id"
56015601 task_queue = "tq"
@@ -5688,10 +5688,9 @@ async def _run_workflow_and_get_warning(self) -> int:
56885688 == "Deliberately failing post-ContinueAsNew run"
56895689 )
56905690
5691- unfinished_handler_warning_emitted = sum (
5692- 1
5691+ unfinished_handler_warning_emitted = any (
5692+ issubclass ( w . category , self . _unfinished_handler_warning_cls )
56935693 for w in warnings
5694- if issubclass (w .category , self ._unfinished_handler_warning_cls )
56955694 )
56965695 return unfinished_handler_warning_emitted
56975696
0 commit comments