From 29c0e4f4a166ea0a31c974452010536f297da017 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 20 Mar 2010 22:22:57 +0000 Subject: Have regrtest monitor the warnings filter for changes made by a test suite. --- Lib/test/regrtest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index e9ca477..d0cd855 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -786,7 +786,8 @@ class saved_test_environment: # the corresponding method names. resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr', - 'os.environ', 'sys.path', 'sys.path_hooks', '__import__') + 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', + 'warnings.filters') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -838,6 +839,12 @@ class saved_test_environment: def restore___import__(self, import_): __builtins__.__import__ = import_ + def get_warnings_filters(self): + return id(warnings.filters), warnings.filters, warnings.filters[:] + def restore_warnings_filters(self, saved_filters): + warnings.filters = saved_filters[1] + warnings.filters[:] = saved_filters[2] + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') -- cgit v0.12