@@ -110,12 +110,14 @@ async def _just_log_task(*args, **kwargs) -> None:
110110
111111
112112@asynccontextmanager
113- async def auto_remove_task (client : HttpClient , task_id : TaskId ) -> AsyncIterator [None ]:
113+ async def auto_remove_task (
114+ http_client : HttpClient , task_id : TaskId
115+ ) -> AsyncIterator [None ]:
114116 """clenup pending tasks"""
115117 try :
116118 yield
117119 finally :
118- await client .remove_task (task_id , timeout = 10 )
120+ await http_client .remove_task (task_id , timeout = 10 )
119121
120122
121123async def _get_container_timestamps (
@@ -225,7 +227,7 @@ async def httpx_async_client(
225227
226228
227229@pytest .fixture
228- def client (
230+ def http_client (
229231 app : FastAPI , httpx_async_client : AsyncClient , backend_url : AnyHttpUrl
230232) -> HttpClient :
231233 return HttpClient (
@@ -275,17 +277,17 @@ def mock_nodeports(mocker: MockerFixture) -> None:
275277 ]
276278)
277279async def mock_port_keys (
278- request : pytest .FixtureRequest , client : HttpClient
280+ request : pytest .FixtureRequest , http_client : HttpClient
279281) -> list [str ] | None :
280- outputs_context : OutputsContext = client .app .state .outputs_context
282+ outputs_context : OutputsContext = http_client .app .state .outputs_context
281283 if request .param is not None :
282284 await outputs_context .set_file_type_port_keys (request .param )
283285 return request .param
284286
285287
286288@pytest .fixture
287- def outputs_manager (client : HttpClient ) -> OutputsManager :
288- return client .app .state .outputs_manager
289+ def outputs_manager (http_client : HttpClient ) -> OutputsManager :
290+ return http_client .app .state .outputs_manager
289291
290292
291293@pytest .fixture
@@ -430,7 +432,7 @@ async def _assert_progress_finished(
430432
431433async def test_create_containers_task (
432434 httpx_async_client : AsyncClient ,
433- client : HttpClient ,
435+ http_client : HttpClient ,
434436 compose_spec : str ,
435437 mock_stop_heart_beat_task : AsyncMock ,
436438 mock_metrics_params : CreateServiceMetricsAdditionalParams ,
@@ -447,7 +449,7 @@ async def create_progress(
447449 print (message , percent )
448450
449451 async with periodic_task_result (
450- client = client ,
452+ client = http_client ,
451453 task_id = await _get_task_id_create_service_containers (
452454 httpx_async_client , compose_spec , mock_metrics_params
453455 ),
@@ -462,7 +464,7 @@ async def create_progress(
462464
463465async def test_pull_user_servcices_docker_images (
464466 httpx_async_client : AsyncClient ,
465- client : HttpClient ,
467+ http_client : HttpClient ,
466468 compose_spec : str ,
467469 mock_stop_heart_beat_task : AsyncMock ,
468470 mock_metrics_params : CreateServiceMetricsAdditionalParams ,
@@ -479,7 +481,7 @@ async def create_progress(
479481 print (message , percent )
480482
481483 async with periodic_task_result (
482- client = client ,
484+ client = http_client ,
483485 task_id = await _get_task_id_create_service_containers (
484486 httpx_async_client , compose_spec , mock_metrics_params
485487 ),
@@ -492,7 +494,7 @@ async def create_progress(
492494 await _assert_progress_finished (last_progress_message )
493495
494496 async with periodic_task_result (
495- client = client ,
497+ client = http_client ,
496498 task_id = await _get_task_id_pull_user_servcices_docker_images (
497499 httpx_async_client , compose_spec , mock_metrics_params
498500 ),
@@ -506,13 +508,13 @@ async def create_progress(
506508
507509async def test_create_containers_task_invalid_yaml_spec (
508510 httpx_async_client : AsyncClient ,
509- client : HttpClient ,
511+ http_client : HttpClient ,
510512 mock_stop_heart_beat_task : AsyncMock ,
511513 mock_metrics_params : CreateServiceMetricsAdditionalParams ,
512514):
513515 with pytest .raises (InvalidComposeSpecError ) as exec_info :
514516 async with periodic_task_result (
515- client = client ,
517+ client = http_client ,
516518 task_id = await _get_task_id_create_service_containers (
517519 httpx_async_client , "" , mock_metrics_params
518520 ),
@@ -540,7 +542,7 @@ async def test_create_containers_task_invalid_yaml_spec(
540542)
541543async def test_same_task_id_is_returned_if_task_exists (
542544 httpx_async_client : AsyncClient ,
543- client : HttpClient ,
545+ http_client : HttpClient ,
544546 mocker : MockerFixture ,
545547 get_task_id_callable : Callable [..., Awaitable ],
546548 mock_stop_heart_beat_task : AsyncMock ,
@@ -559,22 +561,22 @@ def _get_awaitable() -> Awaitable:
559561 with mock_tasks (mocker ):
560562 task_id = await _get_awaitable ()
561563 assert task_id .endswith ("unique" )
562- async with auto_remove_task (client , task_id ):
564+ async with auto_remove_task (http_client , task_id ):
563565 assert await _get_awaitable () == task_id
564566
565567 # since the previous task was already removed it is again possible
566568 # to create a task and it will share the same task_id
567569 new_task_id = await _get_awaitable ()
568570 assert new_task_id .endswith ("unique" )
569571 assert new_task_id == task_id
570- async with auto_remove_task (client , task_id ):
572+ async with auto_remove_task (http_client , task_id ):
571573 pass
572574
573575
574576async def test_containers_down_after_starting (
575577 mock_ensure_read_permissions_on_user_service_data : None ,
576578 httpx_async_client : AsyncClient ,
577- client : HttpClient ,
579+ http_client : HttpClient ,
578580 compose_spec : str ,
579581 mock_stop_heart_beat_task : AsyncMock ,
580582 mock_metrics_params : CreateServiceMetricsAdditionalParams ,
@@ -584,7 +586,7 @@ async def test_containers_down_after_starting(
584586):
585587 # start containers
586588 async with periodic_task_result (
587- client = client ,
589+ client = http_client ,
588590 task_id = await _get_task_id_create_service_containers (
589591 httpx_async_client , compose_spec , mock_metrics_params
590592 ),
@@ -596,7 +598,7 @@ async def test_containers_down_after_starting(
596598
597599 # put down containers
598600 async with periodic_task_result (
599- client = client ,
601+ client = http_client ,
600602 task_id = await _get_task_id_docker_compose_down (httpx_async_client ),
601603 task_timeout = CREATE_SERVICE_CONTAINERS_TIMEOUT ,
602604 status_poll_interval = FAST_STATUS_POLL ,
@@ -607,11 +609,11 @@ async def test_containers_down_after_starting(
607609
608610async def test_containers_down_missing_spec (
609611 httpx_async_client : AsyncClient ,
610- client : HttpClient ,
612+ http_client : HttpClient ,
611613 caplog_info_debug : pytest .LogCaptureFixture ,
612614):
613615 async with periodic_task_result (
614- client = client ,
616+ client = http_client ,
615617 task_id = await _get_task_id_docker_compose_down (httpx_async_client ),
616618 task_timeout = CREATE_SERVICE_CONTAINERS_TIMEOUT ,
617619 status_poll_interval = FAST_STATUS_POLL ,
@@ -622,10 +624,10 @@ async def test_containers_down_missing_spec(
622624
623625
624626async def test_container_restore_state (
625- httpx_async_client : AsyncClient , client : HttpClient , mock_data_manager : None
627+ httpx_async_client : AsyncClient , http_client : HttpClient , mock_data_manager : None
626628):
627629 async with periodic_task_result (
628- client = client ,
630+ client = http_client ,
629631 task_id = await _get_task_id_state_restore (httpx_async_client ),
630632 task_timeout = CREATE_SERVICE_CONTAINERS_TIMEOUT ,
631633 status_poll_interval = FAST_STATUS_POLL ,
@@ -635,10 +637,10 @@ async def test_container_restore_state(
635637
636638
637639async def test_container_save_state (
638- httpx_async_client : AsyncClient , client : HttpClient , mock_data_manager : None
640+ httpx_async_client : AsyncClient , http_client : HttpClient , mock_data_manager : None
639641):
640642 async with periodic_task_result (
641- client = client ,
643+ client = http_client ,
642644 task_id = await _get_task_id_state_save (httpx_async_client ),
643645 task_timeout = CREATE_SERVICE_CONTAINERS_TIMEOUT ,
644646 status_poll_interval = FAST_STATUS_POLL ,
@@ -650,7 +652,7 @@ async def test_container_save_state(
650652@pytest .mark .parametrize ("inputs_pulling_enabled" , [True , False ])
651653async def test_container_pull_input_ports (
652654 httpx_async_client : AsyncClient ,
653- client : HttpClient ,
655+ http_client : HttpClient ,
654656 inputs_pulling_enabled : bool ,
655657 app : FastAPI ,
656658 mock_port_keys : list [str ] | None ,
@@ -660,7 +662,7 @@ async def test_container_pull_input_ports(
660662 enable_inputs_pulling (app )
661663
662664 async with periodic_task_result (
663- client = client ,
665+ client = http_client ,
664666 task_id = await _get_task_id_task_ports_inputs_pull (
665667 httpx_async_client , mock_port_keys
666668 ),
@@ -673,12 +675,12 @@ async def test_container_pull_input_ports(
673675
674676async def test_container_pull_output_ports (
675677 httpx_async_client : AsyncClient ,
676- client : HttpClient ,
678+ http_client : HttpClient ,
677679 mock_port_keys : list [str ] | None ,
678680 mock_nodeports : None ,
679681):
680682 async with periodic_task_result (
681- client = client ,
683+ client = http_client ,
682684 task_id = await _get_task_id_task_ports_outputs_pull (
683685 httpx_async_client , mock_port_keys
684686 ),
@@ -691,12 +693,12 @@ async def test_container_pull_output_ports(
691693
692694async def test_container_push_output_ports (
693695 httpx_async_client : AsyncClient ,
694- client : HttpClient ,
696+ http_client : HttpClient ,
695697 mock_port_keys : list [str ] | None ,
696698 mock_nodeports : None ,
697699):
698700 async with periodic_task_result (
699- client = client ,
701+ client = http_client ,
700702 task_id = await _get_task_id_task_ports_outputs_push (
701703 httpx_async_client , mock_port_keys
702704 ),
@@ -709,7 +711,7 @@ async def test_container_push_output_ports(
709711
710712async def test_container_push_output_ports_missing_node (
711713 httpx_async_client : AsyncClient ,
712- client : HttpClient ,
714+ http_client : HttpClient ,
713715 mock_port_keys : list [str ] | None ,
714716 missing_node_uuid : str ,
715717 mock_node_missing : None ,
@@ -720,7 +722,7 @@ async def test_container_push_output_ports_missing_node(
720722
721723 async def _test_code () -> None :
722724 async with periodic_task_result (
723- client = client ,
725+ client = http_client ,
724726 task_id = await _get_task_id_task_ports_outputs_push (
725727 httpx_async_client , mock_port_keys
726728 ),
@@ -740,14 +742,14 @@ async def _test_code() -> None:
740742
741743async def test_containers_restart (
742744 httpx_async_client : AsyncClient ,
743- client : HttpClient ,
745+ http_client : HttpClient ,
744746 compose_spec : str ,
745747 mock_stop_heart_beat_task : AsyncMock ,
746748 mock_metrics_params : CreateServiceMetricsAdditionalParams ,
747749 shared_store : SharedStore ,
748750):
749751 async with periodic_task_result (
750- client = client ,
752+ client = http_client ,
751753 task_id = await _get_task_id_create_service_containers (
752754 httpx_async_client , compose_spec , mock_metrics_params
753755 ),
@@ -762,7 +764,7 @@ async def test_containers_restart(
762764 container_timestamps_before = await _get_container_timestamps (container_names )
763765
764766 async with periodic_task_result (
765- client = client ,
767+ client = http_client ,
766768 task_id = await _get_task_id_task_containers_restart (
767769 httpx_async_client , DEFAULT_COMMAND_TIMEOUT
768770 ),
0 commit comments