fix test_stream

aplay/arecord should not be tested
This commit is contained in:
Roman Zeyde
2014-08-05 11:11:45 +03:00
parent b865c1c3cc
commit 31a5547237

View File

@@ -1,13 +1,26 @@
from amodem import stream
from amodem import wave
import subprocess as sp
script = r"""
import sys
import time
import os
while True:
time.sleep(0.1)
sys.stdout.write(b'\x00' * 6400)
sys.stderr.write('.')
"""
def test():
p = wave.record('-', stdout=wave.sp.PIPE)
def test_read():
p = sp.Popen(args=['python', '-'], stdin=sp.PIPE, stdout=sp.PIPE)
p.stdin.write(script)
p.stdin.close()
f = stream.Reader(p.stdout)
result = zip(range(10), f)
p.stop()
p.kill()
j = 0
for i, buf in result: