Updated for 2.1a3
[python/dscho.git] / Lib / test / test_openpty.py
blobfb817193d5109501799e74ef0c8ed58843be76aa
1 # Test to see if openpty works. (But don't worry if it isn't available.)
3 import os
4 from test_support import verbose, TestFailed, TestSkipped
6 try:
7 if verbose:
8 print "Calling os.openpty()"
9 master, slave = os.openpty()
10 if verbose:
11 print "(master, slave) = (%d, %d)"%(master, slave)
12 except AttributeError:
13 raise TestSkipped, "No openpty() available."
15 if not os.isatty(master):
16 raise TestFailed, "Master-end of pty is not a terminal."
17 if not os.isatty(slave):
18 raise TestFailed, "Slave-end of pty is not a terminal."
20 os.write(slave, 'Ping!')
21 print os.read(master, 1024)