blob: cd939c69b473de41039f56bdb880aba1c62fa99d [file] [log] [blame]
Guido van Rossuma0f7e852000-07-01 01:13:31 +00001# Test to see if openpty works. (But don't worry if it isn't available.)
2
3import os
4from test_support import verbose, TestFailed
5
6try:
7 if verbose:
8 print "Calling os.openpty()"
9 master, slave = os.openpty()
10 if verbose:
11 print "(master, slave) = (%d, %d)"%(master, slave)
12except AttributeError:
13 raise ImportError, "No openpty() available."
14
15## # Please uncomment these if os.isatty() is added.
16## if not os.isatty(master):
17## raise TestFailed, "Master-end of pty is not a terminal."
18## if not os.isatty(slave):
19## raise TestFailed, "Slave-end of pty is not a terminal."
20
21os.write(slave, 'Ping!')
22print os.read(master, 1024)
23