[Python-checkins] r79158 - python/branches/py3k/Lib/test/regrtest.py

brett.cannon python-checkins at python.org
Sat Mar 20 23:22:57 CET 2010


Author: brett.cannon
Date: Sat Mar 20 23:22:57 2010
New Revision: 79158
Log:
Have regrtest monitor the warnings filter for changes made by a test suite.
Modified:
 python/branches/py3k/Lib/test/regrtest.py
Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Sat Mar 20 23:22:57 2010
@@ -786,7 +786,8 @@
 # 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 @@
 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('.', '_')


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /