From 26a5497bd16db9def3c64437080d8d5a17187b36 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 11 Apr 2023 13:36:52 -0700 Subject: [PATCH] Mark Pulse and ALSA classes as deprecated and remove tests --- ovos_utils/sound/alsa.py | 3 +++ ovos_utils/sound/pulse.py | 4 ++++ test/unittests/test_sound.py | 39 ------------------------------------ 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/ovos_utils/sound/alsa.py b/ovos_utils/sound/alsa.py index 1fda5bcf..3acb0c03 100644 --- a/ovos_utils/sound/alsa.py +++ b/ovos_utils/sound/alsa.py @@ -9,6 +9,9 @@ class AlsaControl: _mixer = None def __init__(self, control=None): + # TODO: Deprecate class in 0.1 + LOG.warning(f"This class is deprecated! Controls moved to" + f"ovos_phal_plugin_alsa.AlsaVolumeControlPlugin") if alsaaudio is None: LOG.error("pyalsaaudio not installed") LOG.info("Run pip install pyalsaaudio==0.8.2") diff --git a/ovos_utils/sound/pulse.py b/ovos_utils/sound/pulse.py index de0b0695..a5cc4665 100644 --- a/ovos_utils/sound/pulse.py +++ b/ovos_utils/sound/pulse.py @@ -1,6 +1,7 @@ import subprocess import re import collections +from ovos_utils.log import LOG class PulseAudio: @@ -8,6 +9,9 @@ class PulseAudio: mute_re = re.compile('^set-sink-mute ([^ ]+) ((?:yes)|(?:no))') def __init__(self): + # TODO: Deprecate class in 0.1 + LOG.warning(f"This class is deprecated! Controls moved to" + f"ovos_phal_plugin_pulseaudio.PulseAudioVolumeControlPlugin") self._mute = collections.OrderedDict() self._volume = collections.OrderedDict() self.update() diff --git a/test/unittests/test_sound.py b/test/unittests/test_sound.py index 1a9cfd61..b95e25c4 100644 --- a/test/unittests/test_sound.py +++ b/test/unittests/test_sound.py @@ -55,42 +55,3 @@ def test_is_speaking(self): def test_wait_while_speaking(self): from ovos_utils.sound import wait_while_speaking # TODO - - -@unittest.skip("Skip ALSA tests") -class TestAlsaControl(unittest.TestCase): - try: - from ovos_utils.sound.alsa import AlsaControl - controller = AlsaControl() - except: - pass - - def test_set_get_volume(self): - self.controller.set_volume(100) - sleep(2) - self.assertFalse(self.controller.is_muted()) - self.assertEqual(self.controller.get_volume(), 100) - - def test_mute_unmute(self): - self.controller.mute() - sleep(2) - self.assertTrue(self.controller.is_muted()) - self.controller.unmute() - sleep(2) - self.assertFalse(self.controller.is_muted()) - - # TODO: Test other methods - - -@unittest.skip("Skip Pulse Audio tests") -class TestPulseAudio(unittest.TestCase): - try: - from ovos_utils.sound.pulse import PulseAudio - controller = PulseAudio() - except: - pass - - def test_list_sources(self): - self.assertIsInstance(self.controller.list_sources(), list) - - # TODO: Test other methods