[Zope-Checkins] CVS: Zope/lib/python/Products/ZODBMountPoint/tests
- testMountPoint.py:1.1.2.3
Chris McDonough
chrism at zopemafia.com
Sat Dec 20 11:58:08 EST 2003
Update of /cvs-repository/Zope/lib/python/Products/ZODBMountPoint/tests
In directory cvs.zope.org:/tmp/cvs-serv29489/tests
Modified Files:
Tag: Zope-2_7-branch
testMountPoint.py
Log Message:
Dont maintain a configuration separate from that of the global config by using a module-scope global. This causes problems when the global config changes (the changes are not picked up here). This is typically an issue when running unit tests.
=== Zope/lib/python/Products/ZODBMountPoint/tests/testMountPoint.py 1.1.2.2 => 1.1.2.3 ===
--- Zope/lib/python/Products/ZODBMountPoint/tests/testMountPoint.py:1.1.2.2 Sat Aug 2 18:56:44 2003
+++ Zope/lib/python/Products/ZODBMountPoint/tests/testMountPoint.py Sat Dec 20 11:58:07 2003
@@ -21,8 +21,8 @@
import ZODB
from OFS.Application import Application
from OFS.Folder import Folder
-from Products.ZODBMountPoint.MountedObject \
- import setConfiguration, manage_addMounts, getMountPoint
+import App.config
+from Products.ZODBMountPoint.MountedObject import manage_addMounts, getMountPoint
from DBTab.DBTab import DBTab
try:
@@ -59,11 +59,18 @@
def getSectionName(self):
return self.name
+original_config = None
+
class DBTabTests (unittest.TestCase):
def setUp(self):
+ global original_config
+ if original_config is None:
+ # stow away original config so we can reset it
+ original_config = App.config.getConfiguration()
+
databases = [TestDBConfig('test_main.fs', ['/']).getDB(),
TestDBConfig('test_mount1.fs', ['/mount1']).getDB(),
TestDBConfig('test_mount2.fs', ['/mount2']).getDB(),
@@ -77,7 +84,9 @@
for point in points:
mount_points[point] = name
conf = DBTab(mount_factories, mount_points)
- setConfiguration(conf)
+ d = App.config.DefaultConfiguration()
+ d.dbtab = conf
+ App.config.setConfiguration(d)
self.conf = conf
db = conf.getDatabase('/')
self.db = db
@@ -90,8 +99,9 @@
get_transaction().commit() # Get the mount points ready
+
def tearDown(self):
- setConfiguration(None)
+ App.config.setConfiguration(original_config)
get_transaction().abort()
self.app._p_jar.close()
del self.app
@@ -99,7 +109,6 @@
for db in self.conf.opened.values():
db.close()
del self.conf
-
def testRead(self):
self.assertEqual(self.app.mount1.id, 'mount1')
More information about the Zope-Checkins
mailing list