summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-01-02 20:04:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-01-02 20:04:52 (GMT)
commitb06146159600b5d9daaf1caf49db43b627ff759f (patch)
treef9e711d2aad67713bd1e31f128bcdfdd223ccead /Lib/test/test_posix.py
parentf11d1832ec6aa06b3eeea67724d9d1ae42ea88a2 (diff)
downloadcpython-b06146159600b5d9daaf1caf49db43b627ff759f.zip
cpython-b06146159600b5d9daaf1caf49db43b627ff759f.tar.gz
cpython-b06146159600b5d9daaf1caf49db43b627ff759f.tar.bz2
Issue #4662: os.tempnam(), os.tmpfile() and os.tmpnam() now raise a py3k
DeprecationWarning.
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 17cdc5b..e2ef2cf 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'):