python-2.5.2/win32/Lib/test/test_openpty.py
changeset 0 ae805ac0140d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python-2.5.2/win32/Lib/test/test_openpty.py	Fri Apr 03 17:19:34 2009 +0100
@@ -0,0 +1,19 @@
+# Test to see if openpty works. (But don't worry if it isn't available.)
+
+import os
+from test.test_support import verbose, TestFailed, TestSkipped
+
+try:
+    if verbose:
+        print "Calling os.openpty()"
+    master, slave = os.openpty()
+    if verbose:
+        print "(master, slave) = (%d, %d)"%(master, slave)
+except AttributeError:
+    raise TestSkipped, "No openpty() available."
+
+if not os.isatty(slave):
+    raise TestFailed, "Slave-end of pty is not a terminal."
+
+os.write(slave, 'Ping!')
+print os.read(master, 1024)