[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - testStart.py:1.5 testZEO.py:1.26

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


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

Modified Files:
	testStart.py testZEO.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/ZEO/tests/testStart.py 1.4 => 1.5 ===
--- StandaloneZODB/ZEO/tests/testStart.py:1.4	Tue Aug  6 10:59:23 2002
+++ StandaloneZODB/ZEO/tests/testStart.py	Thu Aug  8 14:25:10 2002
@@ -22,6 +22,7 @@
 import ZEO.start
 from ZEO.ClientStorage import ClientStorage
 from ZEO.util import Environment
+from ZODB.tests.StorageTestBase import removefs
 
 class StartTests(unittest.TestCase):
 
@@ -38,12 +39,7 @@
             self.stop_server()
             self.shutdown()
         finally:
-            for ext in "", ".index", ".tmp", ".lock", ".old":
-                f = "Data.fs" + ext
-                try:
-                    os.remove(f)
-                except os.error:
-                    pass
+            removefs("Data.fs")
             try:
                 os.remove(self.env.zeo_pid)
             except os.error:


=== StandaloneZODB/ZEO/tests/testZEO.py 1.25 => 1.26 ===
--- StandaloneZODB/ZEO/tests/testZEO.py:1.25	Tue Jun 11 09:43:06 2002
+++ StandaloneZODB/ZEO/tests/testZEO.py	Thu Aug  8 14:25:10 2002
@@ -29,7 +29,7 @@
 import ThreadedAsync, ZEO.trigger
 from ZODB.FileStorage import FileStorage
 from ZODB.Transaction import Transaction
-from ZODB.tests.StorageTestBase import zodb_pickle, MinPO
+from ZODB.tests.StorageTestBase import zodb_pickle, MinPO, removefs
 import zLOG
 
 from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests
@@ -149,13 +149,7 @@
         return 'FileStorage', (self.__fs_base, '1')
 
     def delStorage(self):
-        # file storage appears to create four files
-        for ext in '', '.index', '.lock', '.tmp', '.old':
-            path = self.__fs_base + ext
-            try:
-                os.remove(path)
-            except os.error:
-                pass
+        removefs(self.__fs_base)
 
 class WindowsGenericTests(GenericTests):
     """Subclass to support server creation on Windows.
@@ -192,13 +186,7 @@
         return 'FileStorage', (self.__fs_base, '1') # create=1
 
     def delStorage(self):
-        # file storage appears to create four files
-        for ext in '', '.index', '.lock', '.tmp':
-            path = self.__fs_base + ext
-            try:
-                os.remove(path)
-            except os.error:
-                pass
+        removefs(self.__fs_base)
 
 class ConnectionTests(StorageTestBase.StorageTestBase):
     """Tests that explicitly manage the server process.