From 6dc0d135b4d0e6eb7cf7bbb01569ef4c200ee687 Mon Sep 17 00:00:00 2001 From: Sanniti Date: Thu, 29 Feb 2024 14:07:11 -0500 Subject: [PATCH] remove discountinued loop arg --- .../opentrons/hardware_control/modules/update.py | 4 +--- .../opentrons/hardware_control/test_modules.py | 13 +++++-------- .../robot_server/service/legacy/routers/modules.py | 1 - .../tests/service/legacy/routers/test_modules.py | 2 -- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/api/src/opentrons/hardware_control/modules/update.py b/api/src/opentrons/hardware_control/modules/update.py index 519bb9bbf2ad..51c7d1cd32a4 100644 --- a/api/src/opentrons/hardware_control/modules/update.py +++ b/api/src/opentrons/hardware_control/modules/update.py @@ -3,7 +3,7 @@ import os from pathlib import Path from glob import glob -from typing import Any, AsyncGenerator, Dict, Tuple, Optional, Union +from typing import Any, AsyncGenerator, Dict, Tuple, Union from .types import UpdateError from .mod_abc import AbstractModule from opentrons.hardware_control.threaded_async_lock import ThreadedAsyncLock @@ -23,7 +23,6 @@ async def protect_update_transition() -> AsyncGenerator[None, None]: async def update_firmware( module: AbstractModule, firmware_file: Union[str, Path], - loop: Optional[asyncio.AbstractEventLoop], ) -> None: """Apply update of given firmware file to given module. @@ -34,7 +33,6 @@ async def update_firmware( kwargs: Dict[str, Any] = { "stdout": asyncio.subprocess.PIPE, "stderr": asyncio.subprocess.PIPE, - "loop": loop, } successful, res = await module.bootloader()( flash_port_or_dfu_serial, str(firmware_file), kwargs diff --git a/api/tests/opentrons/hardware_control/test_modules.py b/api/tests/opentrons/hardware_control/test_modules.py index 49e6ba4b7665..b9c0c7944dd5 100644 --- a/api/tests/opentrons/hardware_control/test_modules.py +++ b/api/tests/opentrons/hardware_control/test_modules.py @@ -230,8 +230,6 @@ async def test_module_update_integration( ): from opentrons.hardware_control import modules - loop = asyncio.get_running_loop() - def async_return(result): f = asyncio.Future() f.set_result(result) @@ -240,7 +238,6 @@ def async_return(result): bootloader_kwargs = { "stdout": asyncio.subprocess.PIPE, "stderr": asyncio.subprocess.PIPE, - "loop": loop, } upload_via_avrdude_mock = mock.Mock( @@ -256,14 +253,14 @@ async def mock_find_avrdude_bootloader_port(): ) # test temperature module update with avrdude bootloader - await modules.update_firmware(mod_tempdeck, "fake_fw_file_path", loop) + await modules.update_firmware(mod_tempdeck, "fake_fw_file_path") upload_via_avrdude_mock.assert_called_once_with( "ot_module_avrdude_bootloader1", "fake_fw_file_path", bootloader_kwargs ) upload_via_avrdude_mock.reset_mock() # test magnetic module update with avrdude bootloader - await modules.update_firmware(mod_magdeck, "fake_fw_file_path", loop) + await modules.update_firmware(mod_magdeck, "fake_fw_file_path") upload_via_avrdude_mock.assert_called_once_with( "ot_module_avrdude_bootloader1", "fake_fw_file_path", bootloader_kwargs ) @@ -281,7 +278,7 @@ async def mock_find_bossa_bootloader_port(): modules.update, "find_bootloader_port", mock_find_bossa_bootloader_port ) - await modules.update_firmware(mod_thermocycler, "fake_fw_file_path", loop) + await modules.update_firmware(mod_thermocycler, "fake_fw_file_path") upload_via_bossa_mock.assert_called_once_with( "ot_module_bossa_bootloader1", "fake_fw_file_path", bootloader_kwargs ) @@ -299,7 +296,7 @@ async def mock_find_dfu_device_hs(pid: str, expected_device_count: int): monkeypatch.setattr(modules.update, "find_dfu_device", mock_find_dfu_device_hs) - await modules.update_firmware(mod_heatershaker, "fake_fw_file_path", loop) + await modules.update_firmware(mod_heatershaker, "fake_fw_file_path") upload_via_dfu_mock.assert_called_once_with( "df11", "fake_fw_file_path", bootloader_kwargs ) @@ -312,7 +309,7 @@ async def mock_find_dfu_device_tc2(pid: str, expected_device_count: int): monkeypatch.setattr(modules.update, "find_dfu_device", mock_find_dfu_device_tc2) - await modules.update_firmware(mod_thermocycler_gen2, "fake_fw_file_path", loop) + await modules.update_firmware(mod_thermocycler_gen2, "fake_fw_file_path") upload_via_dfu_mock.assert_called_once_with( "df11", "fake_fw_file_path", bootloader_kwargs ) diff --git a/robot-server/robot_server/service/legacy/routers/modules.py b/robot-server/robot_server/service/legacy/routers/modules.py index b6c4c30474fb..5bb48ca15a33 100644 --- a/robot-server/robot_server/service/legacy/routers/modules.py +++ b/robot-server/robot_server/service/legacy/routers/modules.py @@ -158,7 +158,6 @@ async def post_serial_update( modules.update_firmware( matching_module, matching_module.bundled_fw.path, - asyncio.get_event_loop(), ), 100, ) diff --git a/robot-server/tests/service/legacy/routers/test_modules.py b/robot-server/tests/service/legacy/routers/test_modules.py index e98621e69edd..ca04d0192d9b 100644 --- a/robot-server/tests/service/legacy/routers/test_modules.py +++ b/robot-server/tests/service/legacy/routers/test_modules.py @@ -3,7 +3,6 @@ import pytest import asyncio -from decoy import matchers from opentrons.hardware_control import ExecutionManager from opentrons.hardware_control.modules import ( ModuleType, @@ -308,7 +307,6 @@ def test_post_serial_update(api_client, hardware, tempdeck): p.assert_called_once_with( tempdeck, tempdeck._bundled_fw.path, - matchers.IsA(asyncio.AbstractEventLoop), ) body = resp.json()