[Zope-Checkins] CVS: Zope3/lib/python/ZODB/tests - testConnection.py:1.1.2.1

Jeremy Hylton jeremy@zope.com
Mon, 11 Mar 2002 23:58:00 -0500


Update of /cvs-repository/Zope3/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv24971

Added Files:
      Tag: Zope-3x-branch
	testConnection.py 
Log Message:
Add a few tests of IDataManager interface from patch by R. David Murray.

I split the original patch into two pieces.  The abstestIDataManager
contains unit tests that any object implementing IDataManager should
pass.  The module is named abstestXXX because it does not contain a
test suite, just a mixin (abstract) class that specific data manager
implements should use.

testConnection (part of the ZODB test suite) runs the IDataManager
tests on the ZODB Connection.  I used MappingStorage, because it has
the fewest moving parts and is the easy to clean up after.



=== Added File Zope3/lib/python/ZODB/tests/testConnection.py ===
import unittest

from Persistence import Persistent
from Transaction.tests.abstestIDataManager import IDataManagerTests

import ZODB
from ZODB.MappingStorage import MappingStorage

class P(Persistent):
    pass

class ConnectionTests(IDataManagerTests):

    def setUp(self):
        self.storage = MappingStorage()
        self.db = ZODB.DB(self.storage)
        self.datamgr = self.db.open()
        self.obj = P()

    def tearDown(self):
        self.datamgr.close()
        self.db.close()
        self.storage.close()

def test_suite():
    return unittest.makeSuite(ConnectionTests)