[Python-checkins] r60232 - python/trunk/Lib/test/test_descr.py

neal.norwitz python-checkins at python.org
Thu Jan 24 05:14:51 CET 2008


Author: neal.norwitz
Date: Thu Jan 24 05:14:50 2008
New Revision: 60232

Modified:
   python/trunk/Lib/test/test_descr.py
Log:
Fix the tests by restoring __import__.  I think the test is still valid.

Modified: python/trunk/Lib/test/test_descr.py
==============================================================================
--- python/trunk/Lib/test/test_descr.py	(original)
+++ python/trunk/Lib/test/test_descr.py	Thu Jan 24 05:14:50 2008
@@ -4481,7 +4481,6 @@
     import types
     import __builtin__
 
-
     class X(object):
         def __getattr__(self, name):
             # this is called with name == '__bases__' by PyObject_IsInstance()
@@ -4498,9 +4497,12 @@
             return (self, args)
 
     # make an unbound method
-    __builtin__.__import__ = types.MethodType(Y(), None, (pseudoclass, str))
-    import spam
-
+    orig_import = __import__
+    try:
+        __builtin__.__import__ = types.MethodType(Y(), None, (pseudoclass, str))
+        import spam
+    finally:
+        __builtin__.__import__ = orig_import
 
 def test_main():
     #XXXweakref_segfault() # Must be first, somehow


More information about the Python-checkins mailing list