0001 # Test to see if openpty works. (But don't worry if it isn't available.) 0002 0003 import os 0004 from test.test_support import verbose, TestFailed, TestSkipped 0005 0006 try: 0007 if verbose: 0008 print "Calling os.openpty()" 0009 master, slave = os.openpty() 0010 if verbose: 0011 print "(master, slave) = (%d, %d)"%(master, slave) 0012 except AttributeError: 0013 raise TestSkipped, "No openpty() available." 0014 0015 if not os.isatty(slave): 0016 raise TestFailed, "Slave-end of pty is not a terminal." 0017 0018 os.write(slave, 'Ping!') 0019 print os.read(master, 1024) 0020
Generated by PyXR 0.9.4