@@ -419,7 +419,7 @@ async def test_remove_task(
419419 task_id , with_task_context = empty_context
420420 )
421421 await long_running_manager .tasks_manager .remove_task (
422- task_id , with_task_context = empty_context
422+ task_id , with_task_context = empty_context , wait_for_removal = True
423423 )
424424 with pytest .raises (TaskNotFoundError ):
425425 await long_running_manager .tasks_manager .get_task_status (
@@ -453,10 +453,10 @@ async def test_remove_task_with_task_context(
453453 # removing task fails if wrong task context given
454454 with pytest .raises (TaskNotFoundError ):
455455 await long_running_manager .tasks_manager .remove_task (
456- task_id , with_task_context = {"wrong_task_context" : 12 }
456+ task_id , with_task_context = {"wrong_task_context" : 12 }, wait_for_removal = True
457457 )
458458 await long_running_manager .tasks_manager .remove_task (
459- task_id , with_task_context = empty_context
459+ task_id , with_task_context = empty_context , wait_for_removal = True
460460 )
461461
462462
@@ -465,11 +465,14 @@ async def test_remove_unknown_task(
465465):
466466 with pytest .raises (TaskNotFoundError ):
467467 await long_running_manager .tasks_manager .remove_task (
468- "invalid_id" , with_task_context = empty_context
468+ "invalid_id" , with_task_context = empty_context , wait_for_removal = True
469469 )
470470
471471 await long_running_manager .tasks_manager .remove_task (
472- "invalid_id" , with_task_context = empty_context , reraise_errors = False
472+ "invalid_id" ,
473+ with_task_context = empty_context ,
474+ wait_for_removal = True ,
475+ reraise_errors = False ,
473476 )
474477
475478
@@ -532,7 +535,7 @@ async def test_list_tasks(
532535 )
533536 for task_index , task_id in enumerate (task_ids ):
534537 await long_running_manager .tasks_manager .remove_task (
535- task_id , with_task_context = empty_context
538+ task_id , with_task_context = empty_context , wait_for_removal = True
536539 )
537540 assert len (
538541 await long_running_manager .tasks_manager .list_tasks (
0 commit comments