mirror of
https://github.com/romanz/amodem.git
synced 2026-05-02 07:47:24 +08:00
fix test_wave
This commit is contained in:
@@ -7,17 +7,21 @@ def test_launch():
|
|||||||
p = wave.launch(tool='true', fname='fname')
|
p = wave.launch(tool='true', fname='fname')
|
||||||
assert p.wait() == 0
|
assert p.wait() == 0
|
||||||
|
|
||||||
|
def test_exit():
|
||||||
p = wave.launch(tool='python', fname='-', stdin=sp.PIPE)
|
p = wave.launch(tool='python', fname='-', stdin=sp.PIPE)
|
||||||
s = b'import sys; sys.exit(42)'
|
s = b'import sys; sys.exit(42)'
|
||||||
p.stdin.write(s)
|
p.stdin.write(s)
|
||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
assert p.wait() == 42
|
assert p.wait() == 42
|
||||||
|
|
||||||
|
def test_io():
|
||||||
p = wave.launch(tool='python', fname='-', stdin=sp.PIPE, stdout=sp.PIPE)
|
p = wave.launch(tool='python', fname='-', stdin=sp.PIPE, stdout=sp.PIPE)
|
||||||
s = b'Hello World!'
|
s = b'Hello World!'
|
||||||
p.stdin.write(b'print("' + s + b'")\n')
|
p.stdin.write(b'print("' + s + b'")\n')
|
||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
assert p.stdout.read(len(s)) == s
|
assert p.stdout.read(len(s)) == s
|
||||||
|
|
||||||
|
def test_kill():
|
||||||
|
p = wave.launch(tool='python', fname='-', stdin=sp.PIPE, stdout=sp.PIPE)
|
||||||
p.kill()
|
p.kill()
|
||||||
assert p.wait() == -signal.SIGKILL
|
assert p.wait() == -signal.SIGKILL
|
||||||
|
|||||||
Reference in New Issue
Block a user