mirror of
https://github.com/romanz/amodem.git
synced 2026-04-21 05:36:42 +08:00
fix test_stream
aplay/arecord should not be tested
This commit is contained in:
@@ -1,13 +1,26 @@
|
|||||||
from amodem import stream
|
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():
|
def test_read():
|
||||||
p = wave.record('-', stdout=wave.sp.PIPE)
|
p = sp.Popen(args=['python', '-'], stdin=sp.PIPE, stdout=sp.PIPE)
|
||||||
|
p.stdin.write(script)
|
||||||
|
p.stdin.close()
|
||||||
f = stream.Reader(p.stdout)
|
f = stream.Reader(p.stdout)
|
||||||
|
|
||||||
result = zip(range(10), f)
|
result = zip(range(10), f)
|
||||||
p.stop()
|
p.kill()
|
||||||
|
|
||||||
j = 0
|
j = 0
|
||||||
for i, buf in result:
|
for i, buf in result:
|
||||||
|
|||||||
Reference in New Issue
Block a user