Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): module update process bug #14572

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions api/src/opentrons/hardware_control/modules/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
12 changes: 5 additions & 7 deletions api/tests/opentrons/hardware_control/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -255,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
)
Expand All @@ -280,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
)
Expand All @@ -298,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
)
Expand All @@ -311,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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ async def post_serial_update(
modules.update_firmware(
matching_module,
matching_module.bundled_fw.path,
asyncio.get_event_loop(),
),
100,
)
Expand Down
2 changes: 0 additions & 2 deletions robot-server/tests/service/legacy/routers/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
Loading