66884270a8
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>
28 lines
654 B
Python
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()
|