From 974df919dbcd430794139db7cdf43a43760c058e Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Fri, 15 Aug 2014 11:55:41 +0300 Subject: [PATCH] add UT for wave.py --- tests/test_wave.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_wave.py diff --git a/tests/test_wave.py b/tests/test_wave.py new file mode 100644 index 0000000..fa471e5 --- /dev/null +++ b/tests/test_wave.py @@ -0,0 +1,23 @@ +from amodem import wave +import subprocess as sp +import signal + + +def test_launch(): + p = wave.launch('cat', stdin=sp.PIPE) + p.stdin.close() + assert p.wait() == 0 + + p = wave.launch('bash', stdin=sp.PIPE) + p.stdin.write(b'exit 42') + p.stdin.close() + assert p.wait() == 42 + + p = wave.launch('cat', stdin=sp.PIPE, stdout=sp.PIPE) + s = b'Hello World!' + p.stdin.write(s) + p.stdin.flush() + assert p.stdout.read(len(s)) == s + + p.kill() + assert p.wait() == -signal.SIGKILL