]> git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_openpty.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_openpty.py
1 # Test to see if openpty works. (But don't worry if it isn't available.)
2
3 import os, unittest
4 from test.test_support import run_unittest
5
6 if not hasattr(os, "openpty"):
7 raise unittest.SkipTest, "No openpty() available."
8
9
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.")
15
16 os.write(slave, 'Ping!')
17 self.assertEqual(os.read(master, 1024), 'Ping!')
18
19 def test_main():
20 run_unittest(OpenptyTest)
21
22 if __name__ == '__main__':
23 test_main()