Test cleanup and fixes

remotes/origin/extra-event-options
Phil Howard 2019-10-10 15:52:43 +01:00
parent d64f7ba650
commit b23b666a34
3 changed files with 11 additions and 12 deletions

View File

@ -6,7 +6,6 @@ from mopidy import core
import pykka import pykka
from.pinconfig import PinConfig
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -27,13 +26,10 @@ class RaspberryGPIOFrontend(pykka.ThreadingActor, core.CoreListener):
for key in self.config: for key in self.config:
if key.startswith("bcm"): if key.startswith("bcm"):
pin = int(key.replace("bcm", "")) pin = int(key.replace("bcm", ""))
# settings = PinConfig().deserialize(
# self.config[key]
# )
settings = self.config[key] settings = self.config[key]
if settings is None: if settings is None:
continue continue
pull = GPIO.PUD_UP pull = GPIO.PUD_UP
edge = GPIO.FALLING edge = GPIO.FALLING
if settings.active == 'active_high': if settings.active == 'active_high':

View File

@ -6,12 +6,16 @@ import mock
import pytest 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 = { dummy_config = {
"raspberry-gpio": { "raspberry-gpio": {
"bcm1": "play_pause,active_low,30" # Plugins expect settings to be deserialized
"bcm1": deserialize("play_pause,active_low,30")
} }
} }

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py27, flake8, check-manifest envlist = py27, py27-flake8, py27-check-manifest
[testenv] [testenv]
sitepackages = true sitepackages = true
@ -15,14 +15,13 @@ commands =
--cov=mopidy_raspberry_gpio --cov-report=term-missing \ --cov=mopidy_raspberry_gpio --cov-report=term-missing \
{posargs} {posargs}
[testenv:flake8] [testenv:py27-flake8]
deps = deps =
flake8 flake8
flake8-import-order flake8-import-order
skip_install = true skip_install = true
commands = python -m flake8 commands = python -m flake8
[testenv:check-manifest] [testenv:py27-check-manifest]
deps = check-manifest deps = check-manifest
skip_install = true commands = check-manifest
commands = python -m check-manifest