Skip to content

Commit

Permalink
Mark Pulse and ALSA classes as deprecated and remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Apr 11, 2023
1 parent 3cb4de4 commit 26a5497
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
3 changes: 3 additions & 0 deletions ovos_utils/sound/alsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions ovos_utils/sound/pulse.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import subprocess
import re
import collections
from ovos_utils.log import LOG


class PulseAudio:
volume_re = re.compile('^set-sink-volume ([^ ]+) (.*)')
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()
Expand Down
39 changes: 0 additions & 39 deletions test/unittests/test_sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 26a5497

Please sign in to comment.