From f3f47f658e5239487306fa5e8b878ba78852374a Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Sat, 2 Aug 2014 21:34:12 -0400 Subject: [PATCH] * Added tester for wpylib.iofmt submodules and objects: first test is for text_output "with" invocation. --- TESTS/test_iofmt.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 TESTS/test_iofmt.py diff --git a/TESTS/test_iofmt.py b/TESTS/test_iofmt.py new file mode 100644 index 0000000..b0cab77 --- /dev/null +++ b/TESTS/test_iofmt.py @@ -0,0 +1,19 @@ + + +def test_with_text_output1(): + """[20140804] + Test text_output with() facility.""" + from wpylib.iofmt.text_output import text_output + from wpylib.shell_tools import run + from os import getpid, system + mypid = getpid() + print "pid = %d" % mypid + print "Open files:" + system("lsof -p %d" % mypid) + print "### entering the 'with' block" + with text_output("/tmp/babiku") as O: + O("this is a test from pid %d\n" % mypid) + system("lsof -p %d | tail" % mypid) + print "### closing now" + system("lsof -p %d | tail" % mypid) +