Skip to content

Commit 3011f0a

Browse files
committed
test: check child run aborts through the client patcher
1 parent 5bf99f2 commit 3011f0a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎tests/unit/actor/test_actor_child_runs.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,10 @@ async def test_failed_child_run_abort_does_not_stop_others(
494494
apify_client_async_patcher: ApifyClientAsyncPatcher, caplog: pytest.LogCaptureFixture
495495
) -> None:
496496
"""A child run that fails to abort is logged, and the other marked child runs are still aborted."""
497-
aborted: list[str] = []
498497

499498
async def abort_run(run_client: Any, *_args: Any, **_kwargs: Any) -> None:
500499
if run_client.resource_id == 'broken-run':
501500
raise RuntimeError('abort failed')
502-
aborted.append(run_client.resource_id)
503501

504502
apify_client_async_patcher.patch(
505503
'run', 'get', replacement_method=lambda run_client: make_run(run_client.resource_id, 'RUNNING')
@@ -518,8 +516,10 @@ async def abort_run(run_client: Any, *_args: Any, **_kwargs: Any) -> None:
518516
Actor.event_manager.emit(event=Event.ABORTING, event_data=EventAbortingData())
519517
await Actor.event_manager.wait_for_all_listeners_to_complete()
520518

521-
assert aborted == ['healthy-run']
519+
aborts = apify_client_async_patcher.calls['run']['abort']
520+
assert sorted(args[0].resource_id for args, _ in aborts) == ['broken-run', 'healthy-run']
522521
assert 'Failed to abort child run "broken"' in caplog.text
522+
assert 'Aborted child run "healthy" with the parent' in caplog.text
523523

524524

525525
async def test_child_run_is_aborted_with_the_client_it_was_started_with() -> None:

0 commit comments

Comments
 (0)