]> granicus.if.org Git - python/commitdiff
Fix the warnings usage in test_posix.
authorBrett Cannon <bcannon@gmail.com>
Sat, 20 Mar 2010 21:53:28 +0000 (21:53 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 20 Mar 2010 21:53:28 +0000 (21:53 +0000)
Lib/test/test_posix.py

index 01cd04438690e6fcc9bd91d053292f3a89e052bd..fa1abe3f154ad2705f8bb7cc247f4292f758b515 100644 (file)
@@ -13,8 +13,6 @@ import shutil
 import unittest
 import warnings
 
-warnings.filterwarnings('ignore', '.* potential security risk .*',
-                        RuntimeWarning)
 
 class PosixTester(unittest.TestCase):
 
@@ -22,9 +20,14 @@ class PosixTester(unittest.TestCase):
         # create empty file
         fp = open(support.TESTFN, 'w+')
         fp.close()
+        self._warnings_manager = support.check_warnings()
+        self._warnings_manager.__enter__()
+        warnings.filterwarnings('ignore', '.* potential security risk .*',
+                                RuntimeWarning)
 
     def tearDown(self):
         support.unlink(support.TESTFN)
+        self._warnings_manager.__exit__(None, None, None)
 
     def testNoArgFunctions(self):
         # test posix functions which take no arguments and have