[Zodb-checkins] CVS: StandaloneZODB/BTrees/tests - testBTrees.py:1.46

Jeremy Hylton jeremy@zope.com
Thu, 8 Aug 2002 14:25:40 -0400


Update of /cvs-repository/StandaloneZODB/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv17911/BTrees/tests

Modified Files:
	testBTrees.py 
Log Message:
Refactor test cleanup to use removefs() helper function.

StorageTestBase.removefs() will attempt to remove files with all the
possible extensions that FileStorage will create.  It will raise
os.error for any error except ENOENT.

Remove many variants of removefs() implemented in the various test
suites.


=== StandaloneZODB/BTrees/tests/testBTrees.py 1.45 => 1.46 ===
--- StandaloneZODB/BTrees/tests/testBTrees.py:1.45	Fri Jun 28 02:32:03 2002
+++ StandaloneZODB/BTrees/tests/testBTrees.py	Thu Aug  8 14:25:10 2002
@@ -22,6 +22,8 @@
 
 from glob import glob
 
+from ZODB.tests.StorageTestBase import removefs
+
 class Base:
     """ Tests common to all types: sets, buckets, and BTrees """
     def tearDown(self):
@@ -31,8 +33,8 @@
     def _getRoot(self):
         from ZODB.FileStorage import FileStorage
         from ZODB.DB import DB
-        n = 'fs_tmp__%s' % os.getpid()
-        s = FileStorage(n)
+        self._fsname = 'fs_tmp__%s' % os.getpid()
+        s = FileStorage(self._fsname)
         db = DB(s)
         root = db.open().root()
         return root
@@ -42,8 +44,7 @@
             root._p_jar._db.close()
 
     def _delDB(self):
-        for file in glob('fs_tmp__*'):
-            os.remove(file)
+        removefs(self._fsname)
 
     def testLoadAndStore(self):
         for i in 0, 10, 1000: