Merged revisions 79539 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79539 | florent.xicluna | 2010-04-01 01:01:03 +0300 (Thu, 01 Apr 2010) | 2 lines

  Replace catch_warnings with check_warnings when it makes sense.  Use assertRaises context manager to simplify some tests.
........
diff --git a/Lib/test/test_cookie.py b/Lib/test/test_cookie.py
index 474b856..839e3e0 100644
--- a/Lib/test/test_cookie.py
+++ b/Lib/test/test_cookie.py
@@ -1,13 +1,9 @@
 # Simple test suite for Cookie.py
 
-from test.test_support import run_unittest, run_doctest
+from test.test_support import run_unittest, run_doctest, check_warnings
 import unittest
 import Cookie
 
-import warnings
-warnings.filterwarnings("ignore",
-                        ".* class is insecure.*",
-                        DeprecationWarning)
 
 class CookieTests(unittest.TestCase):
     # Currently this only tests SimpleCookie
@@ -86,7 +82,9 @@
 
 def test_main():
     run_unittest(CookieTests)
-    run_doctest(Cookie)
+    with check_warnings(('.+Cookie class is insecure; do not use it',
+                         DeprecationWarning)):
+        run_doctest(Cookie)
 
 if __name__ == '__main__':
     test_main()