[Zope-Checkins]
SVN: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/
Added a test for reading ZClasses and their instances from Zope 2.7
Jim Fulton
jim at zope.com
Fri Feb 18 07:18:05 EST 2005
Log message for revision 29201:
Added a test for reading ZClasses and their instances from Zope 2.7
databases.
Changed:
A Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.fs
A Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.txt
U Zope/branches/jim-fix-zclasses/lib/python/ZClasses/tests.py
-=-
Added: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.fs
===================================================================
(Binary files differ)
Property changes on: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.fs
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.txt
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.txt 2005-02-17 22:54:14 UTC (rev 29200)
+++ Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.txt 2005-02-18 12:18:05 UTC (rev 29201)
@@ -0,0 +1,20 @@
+Support for Zope 2.7 databases
+==============================
+
+Let's make sure we can load old ZClasses:
+
+ >>> import os
+ >>> from ZODB.FileStorage import FileStorage
+ >>> sname = os.path.join(os.path.dirname(__file__), '27.fs')
+ >>> s = FileStorage(sname, read_only=True)
+ >>> from ZODB.DB import DB
+ >>> db = DB(s)
+ >>> from Zope2.ClassFactory import ClassFactory
+ >>> db.classFactory = ClassFactory
+ >>> conn = db.open()
+ >>> ac = conn.root()['Application'].ac
+ >>> ac.eek()
+ 'xxx'
+ >>> ac.y = 2
+ >>> ac.eek()
+ 'xx'
Property changes on: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/27.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/tests.py
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ZClasses/tests.py 2005-02-17 22:54:14 UTC (rev 29200)
+++ Zope/branches/jim-fix-zclasses/lib/python/ZClasses/tests.py 2005-02-18 12:18:05 UTC (rev 29201)
@@ -16,7 +16,7 @@
$Id$
"""
-import sys
+import os, sys
import unittest
import ZODB.tests.util
import transaction
@@ -40,6 +40,11 @@
test.globs['some_database'].close()
del sys.modules['ZClasses.example']
+def tearDown27(test):
+ test.globs['db'].close()
+ indexname = os.path.join(os.path.dirname(__file__), '27.fs.index')
+ os.remove(indexname)
+
def test_suite():
return unittest.TestSuite((
@@ -50,6 +55,9 @@
doctest.DocFileSuite("_pmc.txt", setUp=setUp, tearDown=tearDown),
doctest.DocFileSuite("ZClass.txt", setUp=setUp, tearDown=tearDown),
+ doctest.DocFileSuite("27.txt", tearDown=tearDown27,
+ globs=dict(__file__=__file__),
+ ),
))
if __name__ == '__main__':
More information about the Zope-Checkins
mailing list