From 3fb15479ba0ebfeaac0ceef20078c3b38b3d429e Mon Sep 17 00:00:00 2001 From: Derek Maggio Date: Thu, 21 Jul 2022 07:36:21 -0700 Subject: [PATCH] fix: Fix deactivate_heater function --- .../emulation/heater_shaker.py | 2 +- .../integration/test_heatershaker.py | 29 +++++-------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/api/src/opentrons/hardware_control/emulation/heater_shaker.py b/api/src/opentrons/hardware_control/emulation/heater_shaker.py index db9bbc8d9f9..64e8fe17909 100644 --- a/api/src/opentrons/hardware_control/emulation/heater_shaker.py +++ b/api/src/opentrons/hardware_control/emulation/heater_shaker.py @@ -138,7 +138,7 @@ def _get_labware_latch_state(self, command: Command) -> str: return f"M241 STATUS:{self._latch_status.value.upper()}" def _deactivate_heater(self, command: Command) -> str: - self._temperature.set_target(TEMPERATURE_ROOM) + self._temperature.deactivate(TEMPERATURE_ROOM) return "M106" @staticmethod diff --git a/api/tests/opentrons/hardware_control/integration/test_heatershaker.py b/api/tests/opentrons/hardware_control/integration/test_heatershaker.py index 80de3f1b8e4..620d317934c 100644 --- a/api/tests/opentrons/hardware_control/integration/test_heatershaker.py +++ b/api/tests/opentrons/hardware_control/integration/test_heatershaker.py @@ -82,22 +82,7 @@ async def test_deactivate_heater(heatershaker: HeaterShaker) -> None: assert 29.3 <= heatershaker.temperature <= 30.7 await heatershaker.deactivate_heater() - assert heatershaker.target_temperature == TEMPERATURE_ROOM - - # Have to wait for temperature to go down. - # Goes down 2 degrees per tick - await heatershaker.wait_next_poll() - await heatershaker.wait_next_poll() - await heatershaker.wait_next_poll() - await heatershaker.wait_next_poll() - - # Temp should be in range - assert TEMP_ROOM_LOW <= heatershaker.temperature <= TEMP_ROOM_HIGH - - await heatershaker.wait_next_poll() - await heatershaker.wait_next_poll() - await heatershaker.wait_next_poll() - # Temp should remain in range + assert heatershaker.target_temperature is None assert TEMP_ROOM_LOW <= heatershaker.temperature <= TEMP_ROOM_HIGH @@ -106,12 +91,12 @@ async def test_temp(heatershaker: HeaterShaker) -> None: # Have to wait for next poll because target temp will not update until then await heatershaker.wait_next_poll() - await heatershaker.start_set_temperature(100.0) - assert heatershaker.target_temperature == 100.0 - assert heatershaker.temperature != 100.0 + await heatershaker.start_set_temperature(50.0) + assert heatershaker.target_temperature == 50.0 + assert heatershaker.temperature != 50.0 - await heatershaker.await_temperature(100.0) - assert heatershaker.target_temperature == 100.0 + await heatershaker.await_temperature(50.0) + assert heatershaker.target_temperature == 50.0 # Acceptable delta is 0.7 degrees - assert 99.3 <= heatershaker.temperature <= 100.7 + assert 49.3 <= heatershaker.temperature <= 50.7