summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-03-20 22:22:57 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-03-20 22:22:57 (GMT)
commit29c0e4f4a166ea0a31c974452010536f297da017 (patch)
tree86ced44f8ff4925aac930ec9e08794044b7f7a4e /Lib
parent226b2303f425d3337804deed75afa10565e272f4 (diff)
downloadcpython-29c0e4f4a166ea0a31c974452010536f297da017.zip
cpython-29c0e4f4a166ea0a31c974452010536f297da017.tar.gz
cpython-29c0e4f4a166ea0a31c974452010536f297da017.tar.bz2
Have regrtest monitor the warnings filter for changes made by a test suite.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/test/regrtest.py9
1 files changed, 8 insertions, 1 deletions
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('.', '_')