Try to get MPV tests working on null audio device

This commit is contained in:
Sumner Evans
2020-07-06 16:59:07 -06:00
parent 216442e2ec
commit a1552dbe73
3 changed files with 6 additions and 2 deletions

View File

@@ -36,8 +36,6 @@ test:
- apt install xvfb
- Xvfb :119 -screen 0 1024x768x16 &
- 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:
- pipenv run ./cicd/pytest.sh
artifacts:

View File

@@ -24,6 +24,8 @@ class MPVPlayer(Player):
_volume = 100.0
_muted = False
_is_mock = False
@staticmethod
def get_configuration_options() -> Dict[str, Union[Type, Tuple[str, ...]]]:
return {REPLAY_GAIN_KEY: ("Disabled", "Track", "Album")}
@@ -37,6 +39,8 @@ class MPVPlayer(Player):
config: Dict[str, Union[str, int, bool]],
):
self.mpv = mpv.MPV()
if MPVPlayer._is_mock:
self.mpv.audio_device = "null"
self.mpv.audio_client_name = "sublime-music"
self.change_settings(config)

View File

@@ -4,6 +4,8 @@ from time import sleep
from sublime.players.mpv import MPVPlayer
MPVPlayer._is_mock = True
def test_init():
empty_fn = lambda *a, **k: None