[Python-checkins] r78241 - python/branches/py3k/Lib/test/regrtest.py
brett.cannon
python-checkins at python.org
Fri Feb 19 16:57:10 CET 2010
Author: brett.cannon
Date: Fri Feb 19 16:57:10 2010
New Revision: 78241
Log:
Check that sys.path_hooks and __import__ are not changed by tests.
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 Fri Feb 19 16:57:10 2010
@@ -779,7 +779,7 @@
# the corresponding method names.
resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
- 'os.environ', 'sys.path')
+ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__')
def get_sys_argv(self):
return id(sys.argv), sys.argv, sys.argv[:]
@@ -820,6 +820,17 @@
sys.path = saved_path[1]
sys.path[:] = saved_path[2]
+ def get_sys_path_hooks(self):
+ return id(sys.path_hooks), sys.path_hooks, sys.path_hooks[:]
+ def restore_sys_path_hooks(self, saved_hooks):
+ sys.path_hooks = saved_hooks[1]
+ sys.path_hooks[:] = saved_hooks[2]
+
+ def get___import__(self):
+ return __builtins__.__import__
+ def restore___import__(self, import_):
+ __builtins__.__import__ = import_
+
def resource_info(self):
for name in self.resources:
method_suffix = name.replace('.', '_')
More information about the Python-checkins
mailing list