[pypy-svn] r61185 - in pypy/trunk/lib-python: . modified-2.5.2/test

antocuni at codespeak.net antocuni at codespeak.net
Wed Jan 21 14:44:08 CET 2009


Author: antocuni
Date: Wed Jan 21 14:44:08 2009
New Revision: 61185

Added:
   pypy/trunk/lib-python/modified-2.5.2/test/test_importhooks.py
      - copied, changed from r61183, pypy/trunk/lib-python/2.5.2/test/test_importhooks.py
Modified:
   pypy/trunk/lib-python/failure_list.txt
Log:
try hard not to remove 'exceptions' from sys.modules



Modified: pypy/trunk/lib-python/failure_list.txt
==============================================================================
--- pypy/trunk/lib-python/failure_list.txt	(original)
+++ pypy/trunk/lib-python/failure_list.txt	Wed Jan 21 14:44:08 2009
@@ -5,7 +5,6 @@
 test_code                        obscure differences in code objects produced by compiler
 test_codecs                  !   unknown
 test_coding                  !   hah.  fix buildbot :-/
-test_commands                !   unknown
 test_compiler                !   unknown
 test_ctypes                  !   implementation details but also some real crashes
 test_decimal                     missing decimal.ROUND_05UP
@@ -24,7 +23,6 @@
 test_gettext                 !   check this use of unicode()
 test_grammar                     implementation detail
 test_import                      importing from pyc-files-without-py-file disabled by default
-test_importhooks             !   unknown  # SHOULD BE FIXED NOW, check nightly tests
 test_inspect                 !   test_wrapped_decorator: try to fix;  isbuiltin([].append): cry and maaaybe try to fix
 test_iterlen                     somehow implementation detail (missing __length_hint__())
 test_itertools                   same as test_iterlen

Copied: pypy/trunk/lib-python/modified-2.5.2/test/test_importhooks.py (from r61183, pypy/trunk/lib-python/2.5.2/test/test_importhooks.py)
==============================================================================
--- pypy/trunk/lib-python/2.5.2/test/test_importhooks.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_importhooks.py	Wed Jan 21 14:44:08 2009
@@ -238,15 +238,26 @@
 
     def testBlocker(self):
         mname = "exceptions"  # an arbitrary harmless builtin module
+        mod = None
         if mname in sys.modules:
+            mod = sys.modules[mname]
             del sys.modules[mname]
-        sys.meta_path.append(ImportBlocker(mname))
+        blocker = ImportBlocker(mname)
+        sys.meta_path.append(blocker)
         try:
             __import__(mname)
         except ImportError:
             pass
         else:
             self.fail("'%s' was not supposed to be importable" % mname)
+        finally:
+            # try hard to re-insert exceptions into sys.modules, else pypy-c
+            # complains before exiting
+            assert sys.meta_path[-1] is blocker
+            sys.meta_path.pop()
+            self.tracker.imports.remove(mname)
+            if mod:
+                sys.modules[mname] = mod
 
     def testImpWrapper(self):
         i = ImpWrapper()



More information about the Pypy-commit mailing list