forked from auracaster/pyalsaaudio
Add a (naive) loopback implementation (#132)
* WIP * Open/close the playback device when idle. It takes a long time until it's stopped, though. * open/close logic of playback device * Fix opening logic, make period size divisible by 6 * Be less verbose in level info * Extra argument for output mixer card index Sometimes, this cannot be deduced from the output device * Better silence detection * Run run_after_stop when idle on startup
This commit is contained in:
committed by
Oswald Buddenhagen
parent
522131123c
commit
42ca8acbad
27
test.py
27
test.py
@@ -11,6 +11,7 @@
|
||||
import unittest
|
||||
import alsaaudio
|
||||
import warnings
|
||||
from contextlib import closing
|
||||
|
||||
# we can't test read and write well - these are tested otherwise
|
||||
PCMMethods = [
|
||||
@@ -156,5 +157,31 @@ class PCMTest(unittest.TestCase):
|
||||
self.assertEqual(len(w), 1, method + " expected a warning")
|
||||
self.assertTrue(issubclass(w[-1].category, DeprecationWarning), method + " expected a DeprecationWarning")
|
||||
|
||||
class PollDescriptorArgsTest(unittest.TestCase):
|
||||
'''Test invalid args for polldescriptors_revents (takes a list of tuples of 2 integers)'''
|
||||
def testArgsNoList(self):
|
||||
with closing(alsaaudio.PCM()) as pcm:
|
||||
with self.assertRaises(TypeError):
|
||||
pcm.polldescriptors_revents('foo')
|
||||
|
||||
def testArgsListButNoTuples(self):
|
||||
with closing(alsaaudio.PCM()) as pcm:
|
||||
with self.assertRaises(TypeError):
|
||||
pcm.polldescriptors_revents(['foo', 1])
|
||||
|
||||
def testArgsListButInvalidTuples(self):
|
||||
with closing(alsaaudio.PCM()) as pcm:
|
||||
with self.assertRaises(TypeError):
|
||||
pcm.polldescriptors_revents([('foo', 'bar')])
|
||||
|
||||
def testArgsListTupleWrongLength(self):
|
||||
with closing(alsaaudio.PCM()) as pcm:
|
||||
with self.assertRaises(TypeError):
|
||||
pcm.polldescriptors_revents([(1, )])
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
pcm.polldescriptors_revents([(1, 2, 3)])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user