[Zodb-checkins] CVS: ZODB/src/persistent/tests - test_persistent.py:1.1.2.2

Jeremy Hylton jeremy at zope.com
Fri Feb 13 11:38:10 EST 2004


Update of /cvs-repository/ZODB/src/persistent/tests
In directory cvs.zope.org:/tmp/cvs-serv16460/src/persistent/tests

Modified Files:
      Tag: zope3-zodb3-devel-branch
	test_persistent.py 
Log Message:
Only include the interface tests if zope.interface is available.


=== ZODB/src/persistent/tests/test_persistent.py 1.1.2.1 => 1.1.2.2 ===
--- ZODB/src/persistent/tests/test_persistent.py:1.1.2.1	Thu Feb 12 15:56:15 2004
+++ ZODB/src/persistent/tests/test_persistent.py	Fri Feb 13 11:38:09 2004
@@ -16,6 +16,13 @@
 from persistent import Persistent
 from persistent.interfaces import IPersistent
 
+try:
+    import zope.interface
+except ImportError:
+    interfaces = False
+else:
+    interfaces = True
+
 class Test(unittest.TestCase):
 
     klass = None # override in subclass
@@ -176,18 +183,19 @@
         self.assertEqual(p._p_changed, 0)
         self.assertEqual(p.x, 42)
 
-    def testInterface(self):
-        self.assert_(IPersistent.isImplementedByInstancesOf(Persistent),
-                     "%s does not implement IPersistent" % Persistent)
-        p = Persistent()
-        self.assert_(IPersistent.isImplementedBy(p),
-                     "%s does not implement IPersistent" % p)
-
-        self.assert_(IPersistent.isImplementedByInstancesOf(P),
-                     "%s does not implement IPersistent" % P)
-        p = self.klass()
-        self.assert_(IPersistent.isImplementedBy(p),
-                     "%s does not implement IPersistent" % p)
+    if interfaces:
+        def testInterface(self):
+            self.assert_(IPersistent.isImplementedByInstancesOf(Persistent),
+                         "%s does not implement IPersistent" % Persistent)
+            p = Persistent()
+            self.assert_(IPersistent.isImplementedBy(p),
+                         "%s does not implement IPersistent" % p)
+
+            self.assert_(IPersistent.isImplementedByInstancesOf(P),
+                         "%s does not implement IPersistent" % P)
+            p = self.klass()
+            self.assert_(IPersistent.isImplementedBy(p),
+                         "%s does not implement IPersistent" % p)
 
     def testDataManagerAndAttributes(self):
         # Test to cover an odd bug where the instance __dict__ was




More information about the Zodb-checkins mailing list