diff --git a/tests/dummy_mixer.py b/tests/dummy_mixer.py index f030ca2..7cdffcc 100644 --- a/tests/dummy_mixer.py +++ b/tests/dummy_mixer.py @@ -10,8 +10,9 @@ def create_proxy(config=None): class DummyMixer(pykka.ThreadingActor, mixer.Mixer): def __init__(self, config): super().__init__() - self._volume = 50 # Had to be initialised to avoid none type error in tests - self._mute = False # Ditto + # These must be initialised to avoid none type error in tests + self._volume = 50 + self._mute = False def get_volume(self): return self._volume diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 08c3442..bd6c466 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -27,11 +27,7 @@ def dummy_mopidy_core(): mixer = dummy_mixer.create_proxy() audio = dummy_audio.create_proxy() backend = dummy_backend.create_proxy(audio=audio) - return core.Core.start( - audio=audio, - mixer=mixer, - backends=[backend] - ).proxy() + return core.Core.start(audio=audio, mixer=mixer, backends=[backend]).proxy() def test_get_frontend_classes(): @@ -52,7 +48,9 @@ def test_frontend_handler_dispatch_play_pause(): sys.modules["RPi"] = 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") @@ -61,7 +59,9 @@ def test_frontend_handler_dispatch_next(): sys.modules["RPi"] = 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") @@ -70,7 +70,9 @@ def test_frontend_handler_dispatch_prev(): sys.modules["RPi"] = 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") @@ -79,7 +81,9 @@ def test_frontend_handler_dispatch_volume_up(): sys.modules["RPi"] = 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") @@ -88,7 +92,9 @@ def test_frontend_handler_dispatch_volume_down(): sys.modules["RPi"] = 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") @@ -97,7 +103,9 @@ def test_frontend_handler_dispatch_invalid_event(): sys.modules["RPi"] = 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): frontend.dispatch_input("tomato") @@ -107,6 +115,8 @@ def test_frontend_gpio_event(): sys.modules["RPi"] = 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) diff --git a/tox.ini b/tox.ini index d92eb3d..d4deebc 100644 --- a/tox.ini +++ b/tox.ini @@ -20,4 +20,4 @@ commands = python -m check_manifest [testenv:flake8] deps = .[lint] -commands = python -m flake8 --ignore=B950 --show-source --statistics +commands = python -m flake8 --ignore=B950,B305,E501 --show-source --statistics