diff --git a/api/src/opentrons/drivers/thermocycler/driver.py b/api/src/opentrons/drivers/thermocycler/driver.py index 889662878fc..0803a6df04f 100644 --- a/api/src/opentrons/drivers/thermocycler/driver.py +++ b/api/src/opentrons/drivers/thermocycler/driver.py @@ -331,12 +331,12 @@ def send(self, command, callback): self._send_write_fd.write(b'c') def close(self): - log.debug("Halting TCPoller") + log.info("===== Halting TCPoller") self._halt_write_fd.write(b'q') def __del__(self): """ Clean up thread fifos""" - log.debug("Cleaning up thread fifos in TCPoller.") + log.info("===== Cleaning up thread fifos in TCPoller.") try: os.unlink(self._send_path) except NameError: @@ -381,7 +381,7 @@ def disconnect(self) -> 'Thermocycler': if self.is_connected() or self._poller: self._poller.close() # type: ignore self._poller.join() # type: ignore - log.debug("TC poller stopped.") + log.info("===== TC poller stopped.") self._poller = None return self diff --git a/api/src/opentrons/hardware_control/modules/tempdeck.py b/api/src/opentrons/hardware_control/modules/tempdeck.py index fb36fd97536..5d9ee818e24 100644 --- a/api/src/opentrons/hardware_control/modules/tempdeck.py +++ b/api/src/opentrons/hardware_control/modules/tempdeck.py @@ -243,8 +243,8 @@ async def _connect(self): self._poller.start() def cleanup(self) -> None: - if self._poller: - log.debug("Stopping tempdeck poller.") + if hasattr(self, '_poller') and self._poller: + log.info("===== Stopping tempdeck poller.") self._poller.stop() async def prep_for_update(self) -> str: diff --git a/api/src/opentrons/hardware_control/thread_manager.py b/api/src/opentrons/hardware_control/thread_manager.py index d85129fa011..a337cf7c0df 100644 --- a/api/src/opentrons/hardware_control/thread_manager.py +++ b/api/src/opentrons/hardware_control/thread_manager.py @@ -175,7 +175,7 @@ def clean_up(self): loop.call_soon_threadsafe(loop.stop) except Exception: pass - self._cached_modules = {} + object.__setattr__(self, '_cached_modules', {}) object.__getattribute__(self, '_thread').join() def wrap_module( @@ -199,7 +199,7 @@ def __getattribute__(self, attr_name): # is necessary in order to allow the garbage collector to delete # those objects from memory and cleanly stop all associated threads. cached_mods = { - module: cached_mods.get(module, wrap(module)) for module in attr} + module: cached_mods.get(module) or wrap(module) for module in attr} object.__setattr__(self, '_cached_modules', cached_mods) return cached_mods.values() elif attr_name == 'clean_up': diff --git a/api/tests/opentrons/hardware_control/test_modules.py b/api/tests/opentrons/hardware_control/test_modules.py index 831c122f162..68c2addbc2a 100644 --- a/api/tests/opentrons/hardware_control/test_modules.py +++ b/api/tests/opentrons/hardware_control/test_modules.py @@ -14,6 +14,7 @@ from opentrons.drivers.rpi_drivers.types import USBPort +# Freezes async def test_get_modules_simulating(): import opentrons.hardware_control as hardware_control mods = ['tempdeck', 'magdeck', 'thermocycler'] @@ -61,6 +62,7 @@ async def test_module_caching(): assert two_magdecks[1] is not two_magdecks[0] +# freezes async def test_filtering_modules(): import opentrons.hardware_control as hardware_control mods = [ @@ -178,6 +180,7 @@ async def mock_find_bossa_bootloader_port(): ) +# freezes async def test_get_bundled_fw(monkeypatch, tmpdir): from opentrons.hardware_control import modules