move sections
[python/dscho.git] / Lib / test / test_openpty.py
blob20c4fe239c2f21ccc4474dfc820aec71cfb6784f
1 # Test to see if openpty works. (But don't worry if it isn't available.)
3 import os, unittest
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):
11 def test(self):
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!')
19 def test_main():
20 run_unittest(OpenptyTest)
22 if __name__ == '__main__':
23 test_main()