[Zope] how to create Zope-Fictures for Unit-test

Robert Rottermann robert@redcor.ch
Wed, 24 Apr 2002 23:18:54 +0200


Hi there,
I am trying to create a set of Unittests.
To start I have to create an environment with a large number of object in
it.
I would like to create them before the first test runs and destroy them
afterwards.

How can I do that. The samples I found so far asume that the environment is
set up in the setup method and destroyed in the teardonw method. My atempts
to to make them survive a coupple of test have been in vain so far.

This is my code I use to open a connection:
def test_suite ( ) :
    connection =
Zope.DB.open('mydata.fs')#("K:/Programme/zope2.5/zope/var/Data.fs")
    r = connection.root()
    a = Application()
    r['Application'] = a
    root = a
    rediTestSuite = unittest.TestSuite()
    # create a folder to put environment in
    rediTestSuite.addTest(InfoTest(root=root,methodName='CreateTestFolder'))
    # add environment
    #---------- fails -------------
    # since it needs the folder that was created in the former test
    rediTestSuite.addTest(InfoTest(root=root,methodName='FillTestFolder'))
    connection.close()

    return rediTestSuite

thanks for your input

Robert
www.redcor.ch