Files
ModelForge/backend/tests/test_hardware_polling.py

19 lines
521 B
Python

import asyncio
from modelforge_api.services.hardware_polling import HardwarePollingService
from modelforge_api.settings import Settings
def test_polling_collects_once_and_stops_cleanly(monkeypatch) -> None:
polling = HardwarePollingService(Settings(hardware_poll_interval_seconds=5))
calls = 0
def refresh_once() -> None:
nonlocal calls
calls += 1
polling.stop()
monkeypatch.setattr(polling, "_refresh_once", refresh_once)
asyncio.run(polling.run())
assert calls == 1