[Zodb-checkins] CVS: ZODB3/ZODB/tests - testConfig.py:1.12.2.1

Jeremy Hylton cvs-admin at zope.org
Mon Nov 24 12:53:54 EST 2003


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv18704

Modified Files:
      Tag: ZODB3-mvcc-2-branch
	testConfig.py 
Log Message:
Call cleanup() method from _test() method.

Storages all have a cleanup() method, so just call it.  Remove various
storage-specific cleanup code.



=== ZODB3/ZODB/tests/testConfig.py 1.12 => 1.12.2.1 ===
--- ZODB3/ZODB/tests/testConfig.py:1.12	Thu Oct  2 14:17:17 2003
+++ ZODB3/ZODB/tests/testConfig.py	Mon Nov 24 12:53:53 2003
@@ -27,8 +27,13 @@
     def _opendb(self, s):
         return ZODB.config.databaseFromString(s)
 
+    def tearDown(self):
+        if getattr(self, "storage", None) is not None:
+            self.storage.cleanup()
+
     def _test(self, s):
         db = self._opendb(s)
+        self.storage = db._storage
         # Do something with the database to make sure it works
         cn = db.open()
         rt = cn.root()
@@ -56,7 +61,6 @@
             """)
 
     def test_file_config1(self):
-        import ZODB.FileStorage
         path = tempfile.mktemp()
         self._test(
             """
@@ -66,10 +70,8 @@
               </filestorage>
             </zodb>
             """ % path)
-        ZODB.FileStorage.cleanup(path)
 
     def test_file_config2(self):
-        import ZODB.FileStorage
         path = tempfile.mktemp()
         cfg = """
         <zodb>
@@ -81,7 +83,6 @@
         </zodb>
         """ % path
         self.assertRaises(ReadOnlyError, self._test, cfg)
-        ZODB.FileStorage.cleanup(path)
 
     def test_zeo_config(self):
         # We're looking for a port that doesn't exist so a connection attempt
@@ -118,9 +119,6 @@
         except OSError, e:
             if e.errno <> errno.EEXIST:
                 raise
-
-    def tearDown(self):
-        shutil.rmtree(self._path)
 
     def test_bdbfull_simple(self):
         cfg = """




More information about the Zodb-checkins mailing list