[Zope3-checkins] CVS: Zope3/src/zodb/code/tests -
tobeimportedbyatestmodule.py:1.2 atestmodule.py:1.7
test_class.py:1.11 test_module.py:1.14 test_patch.py:1.7
Fred L. Drake, Jr.
fred at zope.com
Fri Feb 20 11:58:07 EST 2004
Update of /cvs-repository/Zope3/src/zodb/code/tests
In directory cvs.zope.org:/tmp/cvs-serv22507/src/zodb/code/tests
Modified Files:
atestmodule.py test_class.py test_module.py test_patch.py
Added Files:
tobeimportedbyatestmodule.py
Log Message:
update to replace ZODB 4 with ZODB 3
=== Zope3/src/zodb/code/tests/tobeimportedbyatestmodule.py 1.1 => 1.2 ===
--- /dev/null Fri Feb 20 11:58:06 2004
+++ Zope3/src/zodb/code/tests/tobeimportedbyatestmodule.py Fri Feb 20 11:57:05 2004
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""This module exists soley to e imported by atestmodule
+
+$Id$
+"""
+
+x = 1
+
+class C:
+ pass
=== Zope3/src/zodb/code/tests/atestmodule.py 1.6 => 1.7 ===
--- Zope3/src/zodb/code/tests/atestmodule.py:1.6 Thu Jun 26 18:41:58 2003
+++ Zope3/src/zodb/code/tests/atestmodule.py Fri Feb 20 11:57:05 2004
@@ -13,7 +13,7 @@
##############################################################################
"""A module used to test persistent module patching."""
-from zodb.utils import *
+from ZODB.utils import *
def aFunc():
def nestedFunc():
@@ -49,5 +49,5 @@
# import a module that won't be imported by something else:
-from zodb.code.tests import test_class
+from zodb.code.tests import tobeimportedbyatestmodule
=== Zope3/src/zodb/code/tests/test_class.py 1.10 => 1.11 ===
--- Zope3/src/zodb/code/tests/test_class.py:1.10 Wed May 7 14:19:08 2003
+++ Zope3/src/zodb/code/tests/test_class.py Fri Feb 20 11:57:05 2004
@@ -16,7 +16,7 @@
from zodb.code.tests.test_module import TestBase
from transaction import get_transaction
-from persistence._persistence import CHANGED, UPTODATE
+from persistent.cPersistence import CHANGED, UPTODATE
class TestClass(TestBase):
=== Zope3/src/zodb/code/tests/test_module.py 1.13 => 1.14 ===
--- Zope3/src/zodb/code/tests/test_module.py:1.13 Thu Jun 26 19:17:51 2003
+++ Zope3/src/zodb/code/tests/test_module.py Fri Feb 20 11:57:05 2004
@@ -16,11 +16,10 @@
import unittest
from persistence.dict import PersistentDict
-from persistence._persistence import UPTODATE
+from persistent import UPTODATE
from transaction import get_transaction
-import zodb.db
-from zodb.storage.mapping import MappingStorage
+import ZODB.tests.util
from zodb.code import tests # import this package, to get at __file__ reliably
from zodb.code.module \
import ManagedRegistry, PersistentModuleImporter, PersistentPackage
@@ -87,7 +86,7 @@
class TestBase(unittest.TestCase):
def setUp(self):
- self.db = zodb.db.DB(MappingStorage())
+ self.db = ZODB.tests.util.DB()
self.root = self.db.open().root()
self.registry = ManagedRegistry()
self.importer = TestPersistentModuleImporter(self.registry)
@@ -101,6 +100,7 @@
self.importer.uninstall()
# just in case
get_transaction().abort()
+ self.db.close()
def sameModules(self, registry):
m1 = self.registry.modules()
@@ -358,17 +358,17 @@
"""Test reloading of modules"""
def setUp(self):
- self.storage = MappingStorage()
+ self.db = ZODB.tests.util.DB()
self.open()
_dir, _file = os.path.split(tests.__file__)
self._pmtest = os.path.join(_dir, "_pmtest.py")
def tearDown(self):
get_transaction().abort()
+ self.db.close()
def open(self):
# open a new db and importer from the storage
- self.db = zodb.db.DB(self.storage)
self.root = self.db.open().root()
self.registry = self.root.get("registry")
if self.registry is None:
@@ -379,7 +379,7 @@
def close(self):
self.importer.uninstall()
- self.db.close()
+ self.root._p_jar.close()
def testModuleReload(self):
self.registry.newModule("pmtest", open(self._pmtest).read())
=== Zope3/src/zodb/code/tests/test_patch.py 1.6 => 1.7 ===
--- Zope3/src/zodb/code/tests/test_patch.py:1.6 Fri Apr 25 15:28:46 2003
+++ Zope3/src/zodb/code/tests/test_patch.py Fri Feb 20 11:57:05 2004
@@ -31,12 +31,19 @@
class TestPatch(unittest.TestCase):
+ def setUp(self):
+ self.olddict = atestmodule.__dict__.copy()
+
+ def tearDown(self):
+ atestmodule.__dict__.clear()
+ atestmodule.__dict__.update(self.olddict)
+
def testPatch(self):
# verify obvious facts of object identity
self.assert_(atestmodule.Bar is atestmodule.Sub.__bases__[0])
self.assert_(atestmodule.aFunc is atestmodule.foo[0])
- moddict = atestmodule.__dict__
+ moddict = self.olddict
convert(atestmodule, {})
newdict = atestmodule.__dict__
@@ -57,9 +64,9 @@
# The patch should not touch modules, functions, etc. that
# are imported from other modules.
- import zodb.utils
- for name in dir(zodb.utils):
- obj = getattr(zodb.utils, name)
+ import ZODB.utils
+ for name in dir(ZODB.utils):
+ obj = getattr(ZODB.utils, name)
if isinstance(obj, type) or isinstance(obj, function):
self.assert_(obj is newdict[name])
More information about the Zope3-Checkins
mailing list