Skip to content

Commit

Permalink
Fix signature of stop
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Jul 22, 2024
1 parent 85a5a8d commit 7deec94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/dodal/devices/thawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ async def set(self, time_to_thaw_for: float):
finally:
await self._control_signal.set(ThawerStates.OFF)

async def stop(self):
@AsyncStatus.wrap
async def stop(self, *args):
if self._thawing_task:
self._thawing_task.cancel()

Expand All @@ -43,6 +44,7 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.thaw_for_time_s = ThawingTimer(self.control)
super().__init__(name)

async def stop(self):
@AsyncStatus.wrap
async def stop(self, *args):
await self.thaw_for_time_s.stop()
await self.control.set(ThawerStates.OFF)
4 changes: 2 additions & 2 deletions tests/devices/unit_tests/test_thawer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from unittest.mock import ANY, AsyncMock, MagicMock, call, patch
from unittest.mock import ANY, AsyncMock, call, patch

import pytest
from ophyd_async.core import DeviceCollector, get_mock_put
Expand Down Expand Up @@ -87,7 +87,7 @@ async def test_given_thawing_already_triggered_when_stop_called_then_stop_thawin
async def test_calling_stop_on_thawer_stops_thawing_timer_and_turns_thawer_off(
thawer: Thawer,
):
thawer.thaw_for_time_s = MagicMock(spec=ThawingTimer)
thawer.thaw_for_time_s.stop = AsyncMock(spec=ThawingTimer)
await thawer.stop()
thawer.thaw_for_time_s.stop.assert_called_once()
get_mock_put(thawer.control).assert_called_once_with(
Expand Down

0 comments on commit 7deec94

Please sign in to comment.