[Zope3-checkins] CVS: Zope3/src/zodb/code/tests - test_patch.py:1.6.48.1

Jim Fulton jim at zope.com
Fri Jan 30 11:16:54 EST 2004


Update of /cvs-repository/Zope3/src/zodb/code/tests
In directory cvs.zope.org:/tmp/cvs-serv10062/src/zodb/code/tests

Modified Files:
      Tag: zope3-zodb3-devel-branch
	test_patch.py 
Log Message:
Changed the test so that it left the real module, atestmodule in
the same state it found it.

Fixed an import to reflect ZODB 3.


=== Zope3/src/zodb/code/tests/test_patch.py 1.6 => 1.6.48.1 ===
--- Zope3/src/zodb/code/tests/test_patch.py:1.6	Fri Apr 25 15:28:46 2003
+++ Zope3/src/zodb/code/tests/test_patch.py	Fri Jan 30 11:16:54 2004
@@ -31,12 +31,19 @@
 
 class TestPatch(unittest.TestCase):
 
+    def setUp(self):
+        self.olddict = atestmodule.__dict__.copy()
+
+    def tearDown(self):
+        atestmodule.__dict__.clear()
+        atestmodule.__dict__.update(self.olddict)
+
     def testPatch(self):
         # verify obvious facts of object identity
         self.assert_(atestmodule.Bar is atestmodule.Sub.__bases__[0])
         self.assert_(atestmodule.aFunc is atestmodule.foo[0])
 
-        moddict = atestmodule.__dict__
+        moddict = self.olddict
         convert(atestmodule, {})
         newdict = atestmodule.__dict__
 
@@ -57,9 +64,9 @@
 
         # The patch should not touch modules, functions, etc. that
         # are imported from other modules.
-        import zodb.utils
-        for name in dir(zodb.utils):
-            obj = getattr(zodb.utils, name)
+        import ZODB.utils
+        for name in dir(ZODB.utils):
+            obj = getattr(ZODB.utils, name)
             if isinstance(obj, type) or isinstance(obj, function):
                 self.assert_(obj is newdict[name])
 




More information about the Zope3-Checkins mailing list