[pypy-svn] r7319 - pypy/trunk/src/pypy/objspace/std/test

bob at codespeak.net bob at codespeak.net
Wed Nov 17 14:44:31 CET 2004


Author: bob
Date: Wed Nov 17 14:44:31 2004
New Revision: 7319

Modified:
   pypy/trunk/src/pypy/objspace/std/test/test_typeobject.py
Log:
fix broken test



Modified: pypy/trunk/src/pypy/objspace/std/test/test_typeobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/test/test_typeobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/test/test_typeobject.py	Wed Nov 17 14:44:31 2004
@@ -116,13 +116,27 @@
         self.assertEquals(type(HasInnerMetaclass), HasInnerMetaclass.__metaclass__)
 
     def test_implicit_metaclass(self):
+        global __metaclass__
+        try:
+            old_metaclass = __metaclass__
+            has_old_metaclass = True
+        except NameError:
+            has_old_metaclass = False
+            
         class __metaclass__(type):
             pass
 
         class HasImplicitMetaclass:
             pass
 
-        self.assertEquals(type(HasImplicitMetaclass), __metaclass__)
+        try:
+            self.assertEquals(type(HasImplicitMetaclass), __metaclass__)
+        finally:
+            if has_old_metaclass:
+                __metaclass__ = old_metaclass
+            else:
+                del __metaclass__
+
 
     def test_mro(self):
         class A_mro(object):



More information about the Pypy-commit mailing list