File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
services/dask-sidecar/tests/unit Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 2828
2929@pytest .fixture ()
3030async def mocked_log_publishing_cb (
31- event_loop : asyncio .AbstractEventLoop ,
3231 mocker : MockerFixture ,
3332) -> AsyncIterable [mock .AsyncMock ]:
3433 async with mocker .AsyncMock () as mocked_callback :
Original file line number Diff line number Diff line change 1313from simcore_service_dask_sidecar .utils import num_available_gpus
1414
1515
16- @pytest .fixture ( scope = "function" )
16+ @pytest .fixture
1717def mock_aiodocker (mocker : MockerFixture ) -> mock .MagicMock :
18- mock_docker = mocker .patch (
18+ return mocker .patch (
1919 "simcore_service_dask_sidecar.utils.aiodocker.Docker" , autospec = True
2020 )
21- return mock_docker
2221
2322
2423def test_num_available_gpus_returns_0_when_container_not_created (
@@ -74,7 +73,7 @@ def test_num_available_gpus_returns_0_when_container_wait_timesout(
7473 mock_aiodocker : mock .MagicMock ,
7574):
7675 mock_aiodocker .return_value .__aenter__ .return_value .containers .run .return_value .wait .side_effect = (
77- asyncio . TimeoutError ()
76+ TimeoutError ()
7877 )
7978 assert num_available_gpus () == 0
8079
@@ -91,6 +90,9 @@ def test_num_available_gpus(
9190 mock_aiodocker : mock .MagicMock ,
9291):
9392 # default with mock should return 0 gpus
93+ mock_aiodocker .return_value .__aenter__ .return_value .containers .run .return_value .wait .return_value = {
94+ "StatusCode" : 0
95+ }
9496 assert num_available_gpus () == 0
9597
9698 # add the correct log
You can’t perform that action at this time.
0 commit comments