| OLD | NEW |
| 1 "Test posix functions" | 1 "Test posix functions" |
| 2 | 2 |
| 3 from test import support | 3 from test import support |
| 4 | 4 |
| 5 try: | 5 try: |
| 6 import posix | 6 import posix |
| 7 except ImportError: | 7 except ImportError: |
| 8 raise support.TestSkipped("posix is not available") | 8 raise support.TestSkipped("posix is not available") |
| 9 | 9 |
| 10 import time | 10 import time |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 # create empty file | 22 # create empty file |
| 23 fp = open(support.TESTFN, 'w+') | 23 fp = open(support.TESTFN, 'w+') |
| 24 fp.close() | 24 fp.close() |
| 25 | 25 |
| 26 def tearDown(self): | 26 def tearDown(self): |
| 27 support.unlink(support.TESTFN) | 27 support.unlink(support.TESTFN) |
| 28 | 28 |
| 29 def testNoArgFunctions(self): | 29 def testNoArgFunctions(self): |
| 30 # test posix functions which take no arguments and have | 30 # test posix functions which take no arguments and have |
| 31 # no side-effects which we need to cleanup (e.g., fork, wait, abort) | 31 # no side-effects which we need to cleanup (e.g., fork, wait, abort) |
| 32 NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdu", "uname", | 32 NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdb", "uname", |
| 33 "times", "getloadavg", | 33 "times", "getloadavg", |
| 34 "getegid", "geteuid", "getgid", "getgroups", | 34 "getegid", "geteuid", "getgid", "getgroups", |
| 35 "getpid", "getpgrp", "getppid", "getuid", | 35 "getpid", "getpgrp", "getppid", "getuid", |
| 36 ] | 36 ] |
| 37 | 37 |
| 38 for name in NO_ARG_FUNCTIONS: | 38 for name in NO_ARG_FUNCTIONS: |
| 39 posix_func = getattr(posix, name, None) | 39 posix_func = getattr(posix, name, None) |
| 40 if posix_func is not None: | 40 if posix_func is not None: |
| 41 posix_func() | 41 posix_func() |
| 42 self.assertRaises(TypeError, posix_func, 1) | 42 self.assertRaises(TypeError, posix_func, 1) |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 finally: | 251 finally: |
| 252 support.rmtree(base_path) | 252 support.rmtree(base_path) |
| 253 os.chdir(curdir) | 253 os.chdir(curdir) |
| 254 | 254 |
| 255 | 255 |
| 256 def test_main(): | 256 def test_main(): |
| 257 support.run_unittest(PosixTester) | 257 support.run_unittest(PosixTester) |
| 258 | 258 |
| 259 if __name__ == '__main__': | 259 if __name__ == '__main__': |
| 260 test_main() | 260 test_main() |
| OLD | NEW |