Implement GPIO button hold detection and LED feedback (story 4-1)

Replace stub ButtonHoldDetector and LEDController with real gpiozero
implementations; update tests to use MockFactory so they run without
physical GPIO hardware.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Edholm
2026-04-22 23:55:42 -04:00
parent ddde3358ef
commit 66884270a8
4 changed files with 102 additions and 5 deletions
+14
View File
@@ -1,12 +1,26 @@
import pytest
from gpiozero import Device
from gpiozero.pins.mock import MockFactory
from planemapper.gpio_ctrl import ButtonHoldDetector, LEDController
@pytest.fixture(autouse=True)
def mock_gpio() -> None:
Device.pin_factory = MockFactory()
def test_button_hold_detector_returns_bool() -> None:
detector = ButtonHoldDetector()
result = detector.check()
assert isinstance(result, bool)
def test_button_hold_detector_not_held_by_default() -> None:
detector = ButtonHoldDetector()
assert detector.check() is False
def test_led_controller_on_off_no_exception() -> None:
led = LEDController()
led.on()