[Zodb-checkins] CVS: Zope3/lib/python/ZODB/tests - testZODB.py:1.10

Jim Fulton jim@zope.com
Thu, 17 Oct 2002 09:29:36 -0400


Update of /cvs-repository/Zope3/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv20540/tests

Modified Files:
	testZODB.py 
Log Message:
The test left some FileStorage files around. I changed the tests
to use a tempfile.mktemp()-based name and fixed the cleanup code
so that the files got deleted. 


=== Zope3/lib/python/ZODB/tests/testZODB.py 1.9 => 1.10 ===
--- Zope3/lib/python/ZODB/tests/testZODB.py:1.9	Mon Aug  5 16:08:38 2002
+++ Zope3/lib/python/ZODB/tests/testZODB.py	Thu Oct 17 09:29:35 2002
@@ -13,12 +13,15 @@
 ##############################################################################
 import os
 import unittest
+import tempfile
 
 import ZODB.DB, ZODB.FileStorage
 from Persistence.PersistentDict import PersistentDict
 from Transaction import get_transaction
 from ZODB.utils import u64
 
+_fsname = tempfile.mktemp() + ".fs"
+
 class ExportImportTests:
 
     def duplicate(self, abort_it, dup_name):
@@ -101,7 +104,7 @@
 class ZODBTests(unittest.TestCase, ExportImportTests):
 
     def setUp(self):
-        self._db = ZODB.FileStorage.DB("ZODBTest.fs", create=1)
+        self._db = ZODB.FileStorage.DB(_fsname, create=1)
         get_transaction().begin()
         conn = self._db.open()
         root = conn.root()
@@ -127,7 +130,7 @@
     def tearDown(self):
         self._db.close()
         for ext in '', '.old', '.tmp', '.lock', '.index':
-            path = 'ZODBTests.fs' + ext
+            path = _fsname + ext
             if os.path.exists(path):
                 os.remove(path)