[Python-checkins] cpython (3.3): Do a better job of ensuring test reproducibility and clean up.
barry.warsaw
python-checkins at python.org
Tue Nov 20 23:12:12 CET 2012
http://hg.python.org/cpython/rev/fc6d7868a192
changeset: 80535:fc6d7868a192
branch: 3.3
parent: 80529:291406748217
user: Barry Warsaw <barry at python.org>
date: Tue Nov 20 17:05:41 2012 -0500
summary:
Do a better job of ensuring test reproducibility and clean up.
files:
Lib/test/test_importlib/import_/test_path.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_importlib/import_/test_path.py b/Lib/test/test_importlib/import_/test_path.py
--- a/Lib/test/test_importlib/import_/test_path.py
+++ b/Lib/test/test_importlib/import_/test_path.py
@@ -98,13 +98,18 @@
new_path_hooks = [zipimport.zipimporter,
_bootstrap.FileFinder.path_hook(
*_bootstrap._get_supported_file_loaders())]
- with util.uncache('email'):
+ missing = object()
+ email = sys.modules.pop('email', missing)
+ try:
with util.import_state(meta_path=sys.meta_path[:],
path=new_path,
path_importer_cache=new_path_importer_cache,
path_hooks=new_path_hooks):
module = import_module('email')
self.assertIsInstance(module, ModuleType)
+ finally:
+ if email is not missing:
+ sys.modules['email'] = email
def test_main():
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list