don't use global configuration

This commit is contained in:
Roman Zeyde
2014-11-09 12:14:54 +02:00
parent c8f5924c12
commit ceb826728a
15 changed files with 326 additions and 300 deletions

29
tests/test_audio.py Normal file
View File

@@ -0,0 +1,29 @@
from amodem import audio
import subprocess as sp
import signal
def test_launch():
p = audio.ALSA(tool='true', Fs=32000).launch(fname='fname')
assert p.wait() == 0
def test_exit():
p = audio.ALSA(tool='python', Fs=32000).launch(fname='-', stdin=sp.PIPE)
s = b'import sys; sys.exit(42)'
p.stdin.write(s)
p.stdin.close()
assert p.wait() == 42
def test_io():
p = audio.ALSA(tool='python', Fs=32000)
p = p.launch(fname='-', stdin=sp.PIPE, stdout=sp.PIPE)
s = b'Hello World!'
p.stdin.write(b'print("' + s + b'")\n')
p.stdin.close()
assert p.stdout.read(len(s)) == s
def test_kill():
p = audio.ALSA(tool='python', Fs=32000)
p = p.launch(fname='-', stdin=sp.PIPE, stdout=sp.PIPE)
p.kill()
assert p.wait() == -signal.SIGKILL