mixer: Move DummyMixer into tests package
This commit is contained in:
parent
016024a081
commit
b554a64aad
@ -2,8 +2,6 @@ from __future__ import absolute_import, unicode_literals
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import pykka
|
|
||||||
|
|
||||||
from mopidy import listener
|
from mopidy import listener
|
||||||
|
|
||||||
|
|
||||||
@ -149,23 +147,3 @@ class MixerListener(listener.Listener):
|
|||||||
:type mute: bool
|
:type mute: bool
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DummyMixer(pykka.ThreadingActor, Mixer):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(DummyMixer, self).__init__()
|
|
||||||
self._volume = None
|
|
||||||
self._mute = None
|
|
||||||
|
|
||||||
def get_volume(self):
|
|
||||||
return self._volume
|
|
||||||
|
|
||||||
def set_volume(self, volume):
|
|
||||||
self._volume = volume
|
|
||||||
|
|
||||||
def get_mute(self):
|
|
||||||
return self._mute
|
|
||||||
|
|
||||||
def set_mute(self, mute):
|
|
||||||
self._mute = mute
|
|
||||||
|
|||||||
29
tests/dummy_mixer.py
Normal file
29
tests/dummy_mixer.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pykka
|
||||||
|
|
||||||
|
from mopidy import mixer
|
||||||
|
|
||||||
|
|
||||||
|
def create_proxy(config=None):
|
||||||
|
return DummyMixer.start(config=None).proxy()
|
||||||
|
|
||||||
|
|
||||||
|
class DummyMixer(pykka.ThreadingActor, mixer.Mixer):
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(DummyMixer, self).__init__()
|
||||||
|
self._volume = None
|
||||||
|
self._mute = None
|
||||||
|
|
||||||
|
def get_volume(self):
|
||||||
|
return self._volume
|
||||||
|
|
||||||
|
def set_volume(self, volume):
|
||||||
|
self._volume = volume
|
||||||
|
|
||||||
|
def get_mute(self):
|
||||||
|
return self._mute
|
||||||
|
|
||||||
|
def set_mute(self, mute):
|
||||||
|
self._mute = mute
|
||||||
@ -6,10 +6,10 @@ import mock
|
|||||||
|
|
||||||
import pykka
|
import pykka
|
||||||
|
|
||||||
from mopidy import core, mixer
|
from mopidy import core
|
||||||
from mopidy.mpd import session, uri_mapper
|
from mopidy.mpd import session, uri_mapper
|
||||||
|
|
||||||
from tests import dummy_backend
|
from tests import dummy_backend, dummy_mixer
|
||||||
|
|
||||||
|
|
||||||
class MockConnection(mock.Mock):
|
class MockConnection(mock.Mock):
|
||||||
@ -33,7 +33,7 @@ class BaseTestCase(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def setUp(self): # noqa: N802
|
def setUp(self): # noqa: N802
|
||||||
self.mixer = mixer.DummyMixer.start().proxy()
|
self.mixer = dummy_mixer.create_proxy()
|
||||||
self.backend = dummy_backend.create_proxy()
|
self.backend = dummy_backend.create_proxy()
|
||||||
self.core = core.Core.start(
|
self.core = core.Core.start(
|
||||||
mixer=self.mixer, backends=[self.backend]).proxy()
|
mixer=self.mixer, backends=[self.backend]).proxy()
|
||||||
|
|||||||
@ -4,13 +4,13 @@ import unittest
|
|||||||
|
|
||||||
import pykka
|
import pykka
|
||||||
|
|
||||||
from mopidy import core, mixer
|
from mopidy import core
|
||||||
from mopidy.core import PlaybackState
|
from mopidy.core import PlaybackState
|
||||||
from mopidy.models import Track
|
from mopidy.models import Track
|
||||||
from mopidy.mpd import dispatcher
|
from mopidy.mpd import dispatcher
|
||||||
from mopidy.mpd.protocol import status
|
from mopidy.mpd.protocol import status
|
||||||
|
|
||||||
from tests import dummy_backend
|
from tests import dummy_backend, dummy_mixer
|
||||||
|
|
||||||
|
|
||||||
PAUSED = PlaybackState.PAUSED
|
PAUSED = PlaybackState.PAUSED
|
||||||
@ -23,7 +23,7 @@ STOPPED = PlaybackState.STOPPED
|
|||||||
|
|
||||||
class StatusHandlerTest(unittest.TestCase):
|
class StatusHandlerTest(unittest.TestCase):
|
||||||
def setUp(self): # noqa: N802
|
def setUp(self): # noqa: N802
|
||||||
self.mixer = mixer.DummyMixer.start().proxy()
|
self.mixer = dummy_mixer.create_proxy()
|
||||||
self.backend = dummy_backend.create_proxy()
|
self.backend = dummy_backend.create_proxy()
|
||||||
self.core = core.Core.start(
|
self.core = core.Core.start(
|
||||||
mixer=self.mixer, backends=[self.backend]).proxy()
|
mixer=self.mixer, backends=[self.backend]).proxy()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user