Fix tests hanging

remotes/origin/python3
Phil Howard 2020-01-23 13:53:49 +00:00
parent 844cead5ba
commit 6b903871e2
4 changed files with 24 additions and 7 deletions

View File

@ -6,7 +6,6 @@ tests of the core and backends.
import pykka
from mopidy import audio

View File

@ -6,7 +6,6 @@ used in tests of the frontends.
import pykka
from mopidy import backend
from mopidy.models import Playlist, Ref, SearchResult

View File

@ -1,5 +1,4 @@
import pykka
from mopidy import mixer

View File

@ -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()