diff options
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 17cdc5bb4b..e2ef2cfaf4 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -38,11 +38,13 @@ class PosixTester(unittest.TestCase): "getpid", "getpgrp", "getppid", "getuid", ] - for name in NO_ARG_FUNCTIONS: - posix_func = getattr(posix, name, None) - if posix_func is not None: - posix_func() - self.assertRaises(TypeError, posix_func, 1) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", "", DeprecationWarning) + for name in NO_ARG_FUNCTIONS: + posix_func = getattr(posix, name, None) + if posix_func is not None: + posix_func() + self.assertRaises(TypeError, posix_func, 1) if hasattr(posix, 'getresuid'): def test_getresuid(self): @@ -290,14 +292,18 @@ class PosixTester(unittest.TestCase): def test_tempnam(self): if hasattr(posix, 'tempnam'): - self.assertTrue(posix.tempnam()) - self.assertTrue(posix.tempnam(os.curdir)) - self.assertTrue(posix.tempnam(os.curdir, 'blah')) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", "tempnam", DeprecationWarning) + self.assertTrue(posix.tempnam()) + self.assertTrue(posix.tempnam(os.curdir)) + self.assertTrue(posix.tempnam(os.curdir, 'blah')) def test_tmpfile(self): if hasattr(posix, 'tmpfile'): - fp = posix.tmpfile() - fp.close() + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", "tmpfile", DeprecationWarning) + fp = posix.tmpfile() + fp.close() def test_utime(self): if hasattr(posix, 'utime'): |