Replace catch_warnings with check_warnings when it makes sense.  Use assertRaises context manager to simplify some tests.
diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py
index 22e4b25..abcb193 100644
--- a/Lib/test/test_global.py
+++ b/Lib/test/test_global.py
@@ -2,9 +2,8 @@
 
 from test.test_support import run_unittest, check_syntax_error
 import unittest
-
 import warnings
-warnings.filterwarnings("error", module="<test string>")
+
 
 class GlobalTests(unittest.TestCase):
 
@@ -45,7 +44,9 @@
 
 
 def test_main():
-    run_unittest(GlobalTests)
+    with warnings.catch_warnings():
+        warnings.filterwarnings("error", module="<test string>")
+        run_unittest(GlobalTests)
 
 if __name__ == "__main__":
     test_main()