diff --git a/tests/dummy_audio.py b/tests/dummy_audio.py index 144f1a4..8e85d0a 100644 --- a/tests/dummy_audio.py +++ b/tests/dummy_audio.py @@ -6,7 +6,6 @@ tests of the core and backends. import pykka - from mopidy import audio diff --git a/tests/dummy_backend.py b/tests/dummy_backend.py index 0ee3d2d..f8e6908 100644 --- a/tests/dummy_backend.py +++ b/tests/dummy_backend.py @@ -6,7 +6,6 @@ used in tests of the frontends. import pykka - from mopidy import backend from mopidy.models import Playlist, Ref, SearchResult diff --git a/tests/dummy_mixer.py b/tests/dummy_mixer.py index 7cdffcc..b80e681 100644 --- a/tests/dummy_mixer.py +++ b/tests/dummy_mixer.py @@ -1,5 +1,4 @@ import pykka - from mopidy import mixer diff --git a/tests/test_frontend.py b/tests/test_frontend.py index bd6c466..393c69e 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -1,15 +1,15 @@ import sys from unittest import mock +import pykka +from mopidy import core + import pytest from mopidy_raspberry_gpio import Extension from mopidy_raspberry_gpio import frontend as frontend_lib from mopidy_raspberry_gpio import pinconfig -from mopidy import core -from . import dummy_mixer -from . import dummy_backend -from . import dummy_audio +from . import dummy_audio, dummy_backend, dummy_mixer deserialize = pinconfig.PinConfig().deserialize @@ -23,6 +23,10 @@ dummy_config = { } +def stop_mopidy_core(): + pykka.ActorRegistry.stop_all() + + def dummy_mopidy_core(): mixer = dummy_mixer.create_proxy() audio = dummy_audio.create_proxy() @@ -43,6 +47,8 @@ def test_get_frontend_classes(): "frontend", frontend_lib.RaspberryGPIOFrontend ) + stop_mopidy_core() + def test_frontend_handler_dispatch_play_pause(): sys.modules["RPi"] = mock.Mock() @@ -54,6 +60,8 @@ def test_frontend_handler_dispatch_play_pause(): frontend.dispatch_input("play_pause") + stop_mopidy_core() + def test_frontend_handler_dispatch_next(): sys.modules["RPi"] = mock.Mock() @@ -65,6 +73,8 @@ def test_frontend_handler_dispatch_next(): frontend.dispatch_input("next") + stop_mopidy_core() + def test_frontend_handler_dispatch_prev(): sys.modules["RPi"] = mock.Mock() @@ -76,6 +86,8 @@ def test_frontend_handler_dispatch_prev(): frontend.dispatch_input("prev") + stop_mopidy_core() + def test_frontend_handler_dispatch_volume_up(): sys.modules["RPi"] = mock.Mock() @@ -87,6 +99,8 @@ def test_frontend_handler_dispatch_volume_up(): frontend.dispatch_input("volume_up") + stop_mopidy_core() + def test_frontend_handler_dispatch_volume_down(): sys.modules["RPi"] = mock.Mock() @@ -98,6 +112,8 @@ def test_frontend_handler_dispatch_volume_down(): frontend.dispatch_input("volume_down") + stop_mopidy_core() + def test_frontend_handler_dispatch_invalid_event(): sys.modules["RPi"] = mock.Mock() @@ -110,6 +126,8 @@ def test_frontend_handler_dispatch_invalid_event(): with pytest.raises(RuntimeError): frontend.dispatch_input("tomato") + stop_mopidy_core() + def test_frontend_gpio_event(): sys.modules["RPi"] = mock.Mock() @@ -120,3 +138,5 @@ def test_frontend_gpio_event(): ) frontend.gpio_event(3) + + stop_mopidy_core()