Skip to content

Commit

Permalink
sleep - fix test quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
IGalat committed Nov 11, 2024
1 parent c04fc91 commit 5acfa8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/tapper/controller/sleep_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def sleep(self, length_of_time: float | str) -> None:
self.kill_if_required()
self.pause_if_required()
sleep_time = parse_sleep_time(length_of_time)
while round(sleep_time, 3) > 0:
while sleep_time > 0:
sleep_time = round(sleep_time, 3)
to_sleep = min(self.check_interval, sleep_time)
self.actual_sleep_fn(to_sleep)
sleep_time = sleep_time - to_sleep
Expand Down
2 changes: 1 addition & 1 deletion tests/tapper/controller/test_sleep_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SleepFixture:
mock_actual_sleep: MagicMock | Callable[[Any], None]

def get_time_slept(self) -> float:
return sum(call.args[0] for call in self.mock_actual_sleep.call_args_list)
return sum(call_.args[0] for call_ in self.mock_actual_sleep.call_args_list)


@pytest.fixture
Expand Down

0 comments on commit 5acfa8c

Please sign in to comment.