Commit 4c738d03 authored by Pietro Saccardi's avatar Pietro Saccardi

Mocking RGBLED for testing.

parent bd0f27c2
......@@ -7,7 +7,6 @@ from threading import Lock
from misc.logging import camel_to_snake, ensure_logging_setup
import logging
from misc.settings import SETTINGS
from gpiozero import RGBLED
from Pyro4 import expose as pyro_expose, oneway as pyro_oneway
......@@ -17,6 +16,29 @@ ensure_logging_setup()
_log = logging.getLogger(camel_to_snake(STATUS_LED_PLUGIN_NAME))
from gpiozero import RGBLED
except ImportError:
_log.warning('Could not import RGBLED from gpiozero, running mock.')
class RGBLED:
def __init__(self, *_, **__):
self._value = (0., 0., 0.)
def value(self):
return self._value
def value(self, v):
assert isinstance(v, (tuple, list))
assert len(v) == 3
for comp in v:
assert isinstance(comp, (int, float))
assert 0 <= comp <= 1
self._value = v
def infrange(n):
if isinf(n):
while True:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment