Files
planeMapper/tests/test_gpio_ctrl.py
Matt Edholm 66884270a8 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>
2026-04-22 23:55:42 -04:00

28 lines
654 B
Python

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()
led.off()