Try to get MPV tests working on null audio device
This commit is contained in:
@@ -36,8 +36,6 @@ test:
|
|||||||
- apt install xvfb
|
- apt install xvfb
|
||||||
- Xvfb :119 -screen 0 1024x768x16 &
|
- Xvfb :119 -screen 0 1024x768x16 &
|
||||||
- export DISPLAY=:119
|
- export DISPLAY=:119
|
||||||
- pulseaudio -D --system --exit-idle-time=-1
|
|
||||||
- pactl load-module module-null-sink sink_name=DummyOutput sink_properties=device.description="Virtual_Dummy_Output"
|
|
||||||
script:
|
script:
|
||||||
- pipenv run ./cicd/pytest.sh
|
- pipenv run ./cicd/pytest.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
|
@@ -24,6 +24,8 @@ class MPVPlayer(Player):
|
|||||||
_volume = 100.0
|
_volume = 100.0
|
||||||
_muted = False
|
_muted = False
|
||||||
|
|
||||||
|
_is_mock = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_configuration_options() -> Dict[str, Union[Type, Tuple[str, ...]]]:
|
def get_configuration_options() -> Dict[str, Union[Type, Tuple[str, ...]]]:
|
||||||
return {REPLAY_GAIN_KEY: ("Disabled", "Track", "Album")}
|
return {REPLAY_GAIN_KEY: ("Disabled", "Track", "Album")}
|
||||||
@@ -37,6 +39,8 @@ class MPVPlayer(Player):
|
|||||||
config: Dict[str, Union[str, int, bool]],
|
config: Dict[str, Union[str, int, bool]],
|
||||||
):
|
):
|
||||||
self.mpv = mpv.MPV()
|
self.mpv = mpv.MPV()
|
||||||
|
if MPVPlayer._is_mock:
|
||||||
|
self.mpv.audio_device = "null"
|
||||||
self.mpv.audio_client_name = "sublime-music"
|
self.mpv.audio_client_name = "sublime-music"
|
||||||
self.change_settings(config)
|
self.change_settings(config)
|
||||||
|
|
||||||
|
@@ -4,6 +4,8 @@ from time import sleep
|
|||||||
|
|
||||||
from sublime.players.mpv import MPVPlayer
|
from sublime.players.mpv import MPVPlayer
|
||||||
|
|
||||||
|
MPVPlayer._is_mock = True
|
||||||
|
|
||||||
|
|
||||||
def test_init():
|
def test_init():
|
||||||
empty_fn = lambda *a, **k: None
|
empty_fn = lambda *a, **k: None
|
||||||
|
Reference in New Issue
Block a user