[Zope-CMF] Re: Re: CMFTestCase: Best way to create the CMF site?

Geoff Davis geoff at phds.org
Thu Oct 6 08:12:33 EDT 2005


On Thu, 06 Oct 2005 10:27:16 +0100, Chris Withers wrote:

> OK, so I misunderstood the actual problem Paul was reporting...

My understanding is that CMFTestCase does something like the following:

Test runner for all test modules starts.  
New transaction begins.
For each test module:
  CMFTestCase looks for a site with id CMF_TEST_SITE_ID.  If it doesn't
    exist, it creates a new site with id CMF_TEST_SITE_ID.  Otherwise it
    uses the existing site.

  For each test method:
    CMFTestCase starts a new subtransaction.
    CMFTestCase executes your setup code (if any) on the cmf test site. 
    Your test runs
    CMFTestCase rolls back the subtransaction and restores cmf test site
      to its original state.
Test runner rolls back transaction and restores Zope to its original state.

The result is that CMFTestCase creates a new CMF site for the duration
of the test run and leaves it around for future tests to use.  CMFTestCase
tests look for a site with the given ID and uses it if it is present.

The problem Paul was experiencing appears to be that some CMF tests create
a test site with the same ID as the one he was using for CMFTestCase.  The
CMF tests don't look to see if a site with the specified ID already exists
and as a result they fail when they try to create this site.





More information about the Zope-CMF mailing list