Have regrtest monitor the warnings filter for changes made by a test suite.
This commit is contained in:
parent
226b2303f4
commit
29c0e4f4a1
|
@ -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('.', '_')
|
||||
|
|
Loading…
Reference in New Issue