[Zope3-checkins] CVS: Zope3/src/zodb/storage/tests - test_config.py:1.3

Fred L. Drake, Jr. fred@zope.com
Fri, 3 Jan 2003 16:52:28 -0500


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

Modified Files:
	test_config.py 
Log Message:
Use a helper that uses the old ZConfig stuff until the new stuff gets
integrated more thoroughly.


=== Zope3/src/zodb/storage/tests/test_config.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/test_config.py:1.2	Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/test_config.py	Fri Jan  3 16:52:25 2003
@@ -4,7 +4,7 @@
 import unittest
 from StringIO import StringIO
 
-import ZConfig
+import ZConfig.Context
 
 from zodb import config
 
@@ -33,6 +33,11 @@
         except os.error:
             pass
 
+    def loadConfigText(self, text):
+        context = ZConfig.Context.Context()
+        io = StringIO(text)
+        return context.loadFile(io)
+
     def testFileStorage(self):
         from zodb.storage.file import FileStorage
         sample = """
@@ -42,8 +47,7 @@
         create     yes
         </Storage>
         """ % self.tmpfn
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, FileStorage)
@@ -63,8 +67,7 @@
         wait       no
         </Storage>
         """
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, ClientStorage)
@@ -79,8 +82,7 @@
         type       MappingStorage
         </Storage>
         """
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, MappingStorage)
@@ -96,8 +98,7 @@
         type       zodb.storage.mapping.MappingStorage
         </Storage>
         """
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, MappingStorage)
@@ -120,8 +121,7 @@
         </Storage>
         """ % self.tmpfn
         os.mkdir(self.tmpfn)
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, BDBFullStorage)
@@ -149,8 +149,7 @@
         </Storage>
         """ % self.tmpfn
         os.mkdir(self.tmpfn)
-        io = StringIO(sample)
-        rootconf = ZConfig.loadfile(io)
+        rootconf = self.loadConfigText(sample)
         storageconf = rootconf.getSection("Storage")
         cls, args = config.getStorageInfo(storageconf)
         self.assertEqual(cls, BDBMinimalStorage)