From 3c7c34dd69bec1c80d9d904fdf3708df4da362f8 Mon Sep 17 00:00:00 2001 From: Frank Sinapi Date: Tue, 27 Jun 2023 15:43:02 -0400 Subject: [PATCH] fix(hardware): stop ot3 controller tests hanging (#12994) --- hardware/opentrons_hardware/drivers/can_bus/can_messenger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py index fd2973dfccb..02d8e0bec06 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py +++ b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py @@ -352,7 +352,7 @@ async def _read_task_shield(self) -> None: while True: try: await self._read_task() - except asyncio.CancelledError: + except (asyncio.CancelledError, StopAsyncIteration): return except (CANCommunicationError, AsyncHardwareError, CanError) as e: log.exception(f"Nonfatal error in CAN read task: {e}") @@ -389,6 +389,7 @@ async def _read_task(self) -> None: log.exception(f"Failed to build from {message}") else: log.error(f"Message {message} is not recognized.") + raise StopAsyncIteration async def _handle_error(self, build: BinarySerializable) -> None: err_msg = ErrorMessage(payload=build) # type: ignore[arg-type]