Commit 0abbea6b authored by Jim Fulton's avatar Jim Fulton

Added a test for reading ZClasses and their instances from Zope 2.7

databases.
parent a926126c
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'
......@@ -16,7 +16,7 @@
$Id$
"""
import sys
import os, sys
import unittest
import ZODB.tests.util
import transaction
......@@ -40,6 +40,11 @@ def tearDown(test):
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 @@ def test_suite():
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__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment