[Zodb-checkins] CVS: ZODB3/ZODB/tests - testStorageConfig.py:1.6.4.1
Fred L. Drake, Jr.
fred@zope.com
Fri, 3 Jan 2003 09:59:20 -0500
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv28414/ZODB/tests
Modified Files:
Tag: zconfig-schema-devel-branch
testStorageConfig.py
Log Message:
Use the ZConfig.Context module to get to the old-style ZConfig behavior.
=== ZODB3/ZODB/tests/testStorageConfig.py 1.6 => 1.6.4.1 ===
--- ZODB3/ZODB/tests/testStorageConfig.py:1.6 Wed Dec 18 17:15:05 2002
+++ ZODB3/ZODB/tests/testStorageConfig.py Fri Jan 3 09:59:17 2003
@@ -17,7 +17,7 @@
import unittest
from StringIO import StringIO
-import ZConfig
+import ZConfig.Context
from ZODB import StorageConfig
@@ -46,6 +46,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.FileStorage import FileStorage
sample = """
@@ -55,8 +60,7 @@
create yes
</Storage>
""" % self.tmpfn
- io = StringIO(sample)
- rootconf = ZConfig.loadfile(io)
+ rootconf = self.loadConfigText(sample)
storageconf = rootconf.getSection("Storage")
cls, args = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, FileStorage)
@@ -73,8 +77,7 @@
wait no
</Storage>
"""
- io = StringIO(sample)
- rootconf = ZConfig.loadfile(io)
+ rootconf = self.loadConfigText(sample)
storageconf = rootconf.getSection("Storage")
cls, args = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, ClientStorage)
@@ -89,8 +92,7 @@
type DemoStorage
</Storage>
"""
- io = StringIO(sample)
- rootconf = ZConfig.loadfile(io)
+ rootconf = self.loadConfigText(sample)
storageconf = rootconf.getSection("Storage")
cls, args = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, DemoStorage)
@@ -106,8 +108,7 @@
type ZODB.DemoStorage.DemoStorage
</Storage>
"""
- io = StringIO(sample)
- rootconf = ZConfig.loadfile(io)
+ rootconf = self.loadConfigText(sample)
storageconf = rootconf.getSection("Storage")
cls, args = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, DemoStorage)
@@ -128,8 +129,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 = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, BDBFullStorage)
@@ -155,8 +155,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 = StorageConfig.getStorageInfo(storageconf)
self.assertEqual(cls, BDBMinimalStorage)