Black/Flake8 linting fixes

remotes/origin/python3
Phil Howard 2020-01-23 13:44:58 +00:00
parent c669f5e35c
commit 844cead5ba
3 changed files with 26 additions and 15 deletions

View File

@ -10,8 +10,9 @@ def create_proxy(config=None):
class DummyMixer(pykka.ThreadingActor, mixer.Mixer): class DummyMixer(pykka.ThreadingActor, mixer.Mixer):
def __init__(self, config): def __init__(self, config):
super().__init__() super().__init__()
self._volume = 50 # Had to be initialised to avoid none type error in tests # These must be initialised to avoid none type error in tests
self._mute = False # Ditto self._volume = 50
self._mute = False
def get_volume(self): def get_volume(self):
return self._volume return self._volume

View File

@ -27,11 +27,7 @@ def dummy_mopidy_core():
mixer = dummy_mixer.create_proxy() mixer = dummy_mixer.create_proxy()
audio = dummy_audio.create_proxy() audio = dummy_audio.create_proxy()
backend = dummy_backend.create_proxy(audio=audio) backend = dummy_backend.create_proxy(audio=audio)
return core.Core.start( return core.Core.start(audio=audio, mixer=mixer, backends=[backend]).proxy()
audio=audio,
mixer=mixer,
backends=[backend]
).proxy()
def test_get_frontend_classes(): def test_get_frontend_classes():
@ -52,7 +48,9 @@ def test_frontend_handler_dispatch_play_pause():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.dispatch_input("play_pause") frontend.dispatch_input("play_pause")
@ -61,7 +59,9 @@ def test_frontend_handler_dispatch_next():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.dispatch_input("next") frontend.dispatch_input("next")
@ -70,7 +70,9 @@ def test_frontend_handler_dispatch_prev():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.dispatch_input("prev") frontend.dispatch_input("prev")
@ -79,7 +81,9 @@ def test_frontend_handler_dispatch_volume_up():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.dispatch_input("volume_up") frontend.dispatch_input("volume_up")
@ -88,7 +92,9 @@ def test_frontend_handler_dispatch_volume_down():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.dispatch_input("volume_down") frontend.dispatch_input("volume_down")
@ -97,7 +103,9 @@ def test_frontend_handler_dispatch_invalid_event():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
frontend.dispatch_input("tomato") frontend.dispatch_input("tomato")
@ -107,6 +115,8 @@ def test_frontend_gpio_event():
sys.modules["RPi"] = mock.Mock() sys.modules["RPi"] = mock.Mock()
sys.modules["RPi.GPIO"] = mock.Mock() sys.modules["RPi.GPIO"] = mock.Mock()
frontend = frontend_lib.RaspberryGPIOFrontend(dummy_config, dummy_mopidy_core()) frontend = frontend_lib.RaspberryGPIOFrontend(
dummy_config, dummy_mopidy_core()
)
frontend.gpio_event(3) frontend.gpio_event(3)

View File

@ -20,4 +20,4 @@ commands = python -m check_manifest
[testenv:flake8] [testenv:flake8]
deps = .[lint] deps = .[lint]
commands = python -m flake8 --ignore=B950 --show-source --statistics commands = python -m flake8 --ignore=B950,B305,E501 --show-source --statistics