From b23b666a348b0122913b07ea95a8d6fcdd4eb549 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 10 Oct 2019 15:52:43 +0100 Subject: [PATCH] Test cleanup and fixes --- mopidy_raspberry_gpio/frontend.py | 6 +----- tests/test_frontend.py | 8 ++++++-- tox.ini | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mopidy_raspberry_gpio/frontend.py b/mopidy_raspberry_gpio/frontend.py index 708b59e..166f744 100644 --- a/mopidy_raspberry_gpio/frontend.py +++ b/mopidy_raspberry_gpio/frontend.py @@ -6,7 +6,6 @@ from mopidy import core import pykka -from.pinconfig import PinConfig logger = logging.getLogger(__name__) @@ -27,13 +26,10 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener): for key in self.config: if key.startswith("bcm"): pin = int(key.replace("bcm", "")) - # settings = PinConfig().deserialize( - # self.config[key] - # ) settings = self.config[key] if settings is None: continue - + pull = GPIO.PUD_UP edge = GPIO.FALLING if settings.active == 'active_high': diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 2f9579a..60105b8 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -6,12 +6,16 @@ import mock import pytest -from mopidy_raspberry_gpio import Extension, frontend as frontend_lib +from mopidy_raspberry_gpio import Extension, pinconfig +from mopidy_raspberry_gpio import frontend as frontend_lib +deserialize = pinconfig.PinConfig().deserialize + dummy_config = { "raspberry-gpio": { - "bcm1": "play_pause,active_low,30" + # Plugins expect settings to be deserialized + "bcm1": deserialize("play_pause,active_low,30") } } diff --git a/tox.ini b/tox.ini index abd989b..1e07a84 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, flake8, check-manifest +envlist = py27, py27-flake8, py27-check-manifest [testenv] sitepackages = true @@ -15,14 +15,13 @@ commands = --cov=mopidy_raspberry_gpio --cov-report=term-missing \ {posargs} -[testenv:flake8] +[testenv:py27-flake8] deps = flake8 flake8-import-order skip_install = true commands = python -m flake8 -[testenv:check-manifest] +[testenv:py27-check-manifest] deps = check-manifest -skip_install = true -commands = python -m check-manifest +commands = check-manifest