source: trunk/essentials/dev-lang/python/Lib/test/test_openpty.py@ 3326

Last change on this file since 3326 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 526 bytes
Line 
1# Test to see if openpty works. (But don't worry if it isn't available.)
2
3import os
4from test.test_support import verbose, TestFailed, TestSkipped
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 TestSkipped, "No openpty() available."
14
15if not os.isatty(slave):
16 raise TestFailed, "Slave-end of pty is not a terminal."
17
18os.write(slave, 'Ping!')
19print os.read(master, 1024)
Note: See TracBrowser for help on using the repository browser.