summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_global.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-31 22:01:03 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-31 22:01:03 (GMT)
commit6257a7bbb2660ae75c44f2e71d7ac2ce73900f74 (patch)
tree6f010065c95f2d5617f56e07ba2628be21cf9d7a /Lib/test/test_global.py
parentad5983364966b49c277b495112ae41c6ae2d01ed (diff)
downloadcpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.zip
cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.gz
cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.bz2
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
Diffstat (limited to 'Lib/test/test_global.py')
-rw-r--r--Lib/test/test_global.py7
1 files changed, 4 insertions, 3 deletions
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 @@ x = 2
def test_main():
- run_unittest(GlobalTests)
+ with warnings.catch_warnings():
+ warnings.filterwarnings("error", module="<test string>")
+ run_unittest(GlobalTests)
if __name__ == "__main__":
test_main()