1 # Test to see if openpty works. (But don't worry if it isn't available.)
4 from test
.test_support
import run_unittest
6 if not hasattr(os
, "openpty"):
7 raise unittest
.SkipTest
, "No openpty() available."
10 class OpenptyTest(unittest
.TestCase
):
12 master
, slave
= os
.openpty()
13 if not os
.isatty(slave
):
14 self
.fail("Slave-end of pty is not a terminal.")
16 os
.write(slave
, 'Ping!')
17 self
.assertEqual(os
.read(master
, 1024), 'Ping!')
20 run_unittest(OpenptyTest
)
22 if __name__
== '__main__':